Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aad888f8 authored by Al Viro's avatar Al Viro
Browse files

switch all remaining checks for FILE_OPENED to FMODE_OPENED



... and don't bother with setting FILE_OPENED at all.

Acked-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 69527c55
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1250,7 +1250,7 @@ static int gfs2_atomic_open(struct inode *dir, struct dentry *dentry,
	if (d != NULL)
	if (d != NULL)
		dentry = d;
		dentry = d;
	if (d_really_is_positive(dentry)) {
	if (d_really_is_positive(dentry)) {
		if (!(*opened & FILE_OPENED))
		if (!(file->f_mode & FMODE_OPENED))
			return finish_no_open(file, d);
			return finish_no_open(file, d);
		dput(d);
		dput(d);
		return 0;
		return 0;
+2 −5
Original line number Original line Diff line number Diff line
@@ -3395,11 +3395,10 @@ static int do_last(struct nameidata *nd,
	error = may_open(&nd->path, acc_mode, open_flag);
	error = may_open(&nd->path, acc_mode, open_flag);
	if (error)
	if (error)
		goto out;
		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);
	error = vfs_open(&nd->path, file);
	if (error)
	if (error)
		goto out;
		goto out;
	*opened |= FILE_OPENED;
opened:
opened:
	error = ima_file_check(file, op->acc_mode, *opened);
	error = ima_file_check(file, op->acc_mode, *opened);
	if (!error && will_truncate)
	if (!error && will_truncate)
@@ -3515,8 +3514,6 @@ static struct file *path_openat(struct nameidata *nd,


	if (unlikely(file->f_flags & O_PATH)) {
	if (unlikely(file->f_flags & O_PATH)) {
		error = do_o_path(nd, flags, file);
		error = do_o_path(nd, flags, file);
		if (!error)
			opened |= FILE_OPENED;
		goto out2;
		goto out2;
	}
	}


@@ -3537,7 +3534,7 @@ static struct file *path_openat(struct nameidata *nd,
	terminate_walk(nd);
	terminate_walk(nd);
out2:
out2:
	if (likely(!error)) {
	if (likely(!error)) {
		if (likely(opened & FILE_OPENED))
		if (likely(file->f_mode & FMODE_OPENED))
			return file;
			return file;
		WARN_ON(1);
		WARN_ON(1);
		error = -EINVAL;
		error = -EINVAL;
+2 −7
Original line number Original line Diff line number Diff line
@@ -846,15 +846,10 @@ int finish_open(struct file *file, struct dentry *dentry,
		int (*open)(struct inode *, struct file *),
		int (*open)(struct inode *, struct file *),
		int *opened)
		int *opened)
{
{
	int error;
	BUG_ON(file->f_mode & FMODE_OPENED); /* once it's opened, it's opened */
	BUG_ON(*opened & FILE_OPENED); /* once it's opened, it's opened */


	file->f_path.dentry = dentry;
	file->f_path.dentry = dentry;
	error = do_dentry_open(file, d_backing_inode(dentry), open);
	return do_dentry_open(file, d_backing_inode(dentry), open);
	if (!error)
		*opened |= FILE_OPENED;

	return error;
}
}
EXPORT_SYMBOL(finish_open);
EXPORT_SYMBOL(finish_open);