[PATCH 20/25] vfs: move O_DIRECT check to common code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Miklos Szeredi <mszeredi@xxxxxxx>

Perform open_check_o_direct() in a common place in do_last after opening the
file.

Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxx>
---
 fs/namei.c |   30 +++++++++---------------------
 1 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index fadc95c..4207e4f 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2055,19 +2055,13 @@ static struct file *atomic_create(struct inode *dir, struct dentry *dentry,
 	 * here.
 	 */
 	error = may_open(&filp->f_path, MAY_OPEN, open_flag);
-	if (error)
-		goto out_fput;
-
-	error = open_check_o_direct(filp);
-	if (error)
-		goto out_fput;
+	if (error) {
+		fput(filp);
+		return ERR_PTR(error);
+	}
 
 out:
 	return filp;
-
-out_fput:
-	fput(filp);
-	return ERR_PTR(error);
 }
 
 static struct file *create_open(struct inode *dir, struct dentry *dentry,
@@ -2249,22 +2243,16 @@ static struct file *atomic_open(struct nameidata *nd, struct dentry *dentry,
 		 * permission here.
 		 */
 		error = may_open(&filp->f_path, acc_mode, open_flag);
-		if (error)
-			goto out_fput;
-
-		error = open_check_o_direct(filp);
-		if (error)
-			goto out_fput;
+		if (error) {
+			fput(filp);
+			return ERR_PTR(error);
+		}
 	}
 	*create_error = 0;
 
 out:
 	return filp;
 
-out_fput:
-	fput(filp);
-	return ERR_PTR(error);
-
 look_up:
 	return NULL;
 }
@@ -2588,10 +2576,10 @@ common:
 	}
 	if (IS_ERR(filp))
 		goto out;
+opened:
 	error = open_check_o_direct(filp);
 	if (error)
 		goto exit_fput;
-opened:
 	error = ima_file_check(filp, op->acc_mode);
 	if (error)
 		goto exit_fput;
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux