diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2018-06-08 12:58:04 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2018-07-12 10:04:18 -0400 |
commit | aad888f828fec1e7160b67f122172e7ab7f82e03 (patch) | |
tree | 2f8e5e3c691ae5ecd6e03de48e4912d6f383cb37 | |
parent | 69527c554f82d4bca4b154ccc06ad1554806bdc0 (diff) | |
download | linux-aad888f828fec1e7160b67f122172e7ab7f82e03.tar.bz2 |
switch all remaining checks for FILE_OPENED to FMODE_OPENED
... and don't bother with setting FILE_OPENED at all.
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/gfs2/inode.c | 2 | ||||
-rw-r--r-- | fs/namei.c | 7 | ||||
-rw-r--r-- | fs/open.c | 9 |
3 files changed, 5 insertions, 13 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index feda55f67050..67c588edf8d8 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -1250,7 +1250,7 @@ static int gfs2_atomic_open(struct inode *dir, struct dentry *dentry, if (d != NULL) dentry = d; if (d_really_is_positive(dentry)) { - if (!(*opened & FILE_OPENED)) + if (!(file->f_mode & FMODE_OPENED)) return finish_no_open(file, d); dput(d); return 0; diff --git a/fs/namei.c b/fs/namei.c index d152cc05fdc3..8a1ae074c1c1 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3395,11 +3395,10 @@ finish_open_created: error = may_open(&nd->path, acc_mode, open_flag); if (error) goto out; - BUG_ON(*opened & FILE_OPENED); /* once it's opened, it's opened */ + BUG_ON(file->f_mode & FMODE_OPENED); /* once it's opened, it's opened */ error = vfs_open(&nd->path, file); if (error) goto out; - *opened |= FILE_OPENED; opened: error = ima_file_check(file, op->acc_mode, *opened); if (!error && will_truncate) @@ -3515,8 +3514,6 @@ static struct file *path_openat(struct nameidata *nd, if (unlikely(file->f_flags & O_PATH)) { error = do_o_path(nd, flags, file); - if (!error) - opened |= FILE_OPENED; goto out2; } @@ -3537,7 +3534,7 @@ static struct file *path_openat(struct nameidata *nd, terminate_walk(nd); out2: if (likely(!error)) { - if (likely(opened & FILE_OPENED)) + if (likely(file->f_mode & FMODE_OPENED)) return file; WARN_ON(1); error = -EINVAL; diff --git a/fs/open.c b/fs/open.c index ee893240d199..d2030a3c5c52 100644 --- a/fs/open.c +++ b/fs/open.c @@ -846,15 +846,10 @@ int finish_open(struct file *file, struct dentry *dentry, int (*open)(struct inode *, struct file *), int *opened) { - int error; - BUG_ON(*opened & FILE_OPENED); /* once it's opened, it's opened */ + BUG_ON(file->f_mode & FMODE_OPENED); /* once it's opened, it's opened */ file->f_path.dentry = dentry; - error = do_dentry_open(file, d_backing_inode(dentry), open); - if (!error) - *opened |= FILE_OPENED; - - return error; + return do_dentry_open(file, d_backing_inode(dentry), open); } EXPORT_SYMBOL(finish_open); |