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

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

->atomic_open() prototype change - pass int * instead of bool *



... and let finish_open() report having opened the file via that sucker.
Next step: don't modify od->filp at all.

[AV: FILE_CREATE was already used by cifs; Miklos' fix folded]

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent a8277b9b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ ata *);
	void (*update_time)(struct inode *, struct timespec *, int);
	struct file * (*atomic_open)(struct inode *, struct dentry *,
				struct opendata *, unsigned open_flag,
				umode_t create_mode, bool *created);
				umode_t create_mode, int *opened);

locking rules:
	all may block
+1 −1
Original line number Diff line number Diff line
@@ -366,7 +366,7 @@ struct inode_operations {
	void (*update_time)(struct inode *, struct timespec *, int);
	struct file * (*atomic_open)(struct inode *, struct dentry *,
				struct opendata *, unsigned open_flag,
				umode_t create_mode, bool *created);
				umode_t create_mode, int *opened);
};

Again, all methods are called without any locks being held, unless
+3 −3
Original line number Diff line number Diff line
@@ -859,7 +859,7 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
static struct file *
v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,
		     struct opendata *od, unsigned flags, umode_t mode,
		     bool *created)
		     int *opened)
{
	int err;
	u32 perm;
@@ -918,7 +918,7 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,
		v9inode->writeback_fid = (void *) inode_fid;
	}
	mutex_unlock(&v9inode->v_mutex);
	filp = finish_open(od, dentry, generic_file_open);
	filp = finish_open(od, dentry, generic_file_open, opened);
	if (IS_ERR(filp)) {
		err = PTR_ERR(filp);
		goto error;
@@ -930,7 +930,7 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,
		v9fs_cache_inode_set_cookie(dentry->d_inode, filp);
#endif

	*created = true;
	*opened |= FILE_CREATED;
out:
	dput(res);
	return filp;
+3 −3
Original line number Diff line number Diff line
@@ -243,7 +243,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
static struct file *
v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
			  struct opendata *od, unsigned flags, umode_t omode,
			  bool *created)
			  int *opened)
{
	int err = 0;
	gid_t gid;
@@ -357,7 +357,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
	}
	mutex_unlock(&v9inode->v_mutex);
	/* Since we are opening a file, assign the open fid to the file */
	filp = finish_open(od, dentry, generic_file_open);
	filp = finish_open(od, dentry, generic_file_open, opened);
	if (IS_ERR(filp)) {
		err = PTR_ERR(filp);
		goto err_clunk_old_fid;
@@ -367,7 +367,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
	if (v9ses->cache)
		v9fs_cache_inode_set_cookie(inode, filp);
#endif
	*created = true;
	*opened |= FILE_CREATED;
out:
	dput(res);
	return filp;
+4 −4
Original line number Diff line number Diff line
@@ -636,7 +636,7 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,

struct file *ceph_atomic_open(struct inode *dir, struct dentry *dentry,
			      struct opendata *od, unsigned flags, umode_t mode,
			      bool *created)
			      int *opened)
{
	int err;
	struct dentry *res = NULL;
@@ -650,7 +650,7 @@ struct file *ceph_atomic_open(struct inode *dir, struct dentry *dentry,
		if (err < 0)
			return ERR_PTR(err);

		return ceph_lookup_open(dir, dentry, od, flags, mode);
		return ceph_lookup_open(dir, dentry, od, flags, mode, opened);
	}

	if (d_unhashed(dentry)) {
@@ -668,8 +668,8 @@ struct file *ceph_atomic_open(struct inode *dir, struct dentry *dentry,
		return NULL;
	}

	*created = true;
	filp = ceph_lookup_open(dir, dentry, od, flags, mode);
	*opened |= FILE_CREATED;
	filp = ceph_lookup_open(dir, dentry, od, flags, mode, opened);
	dput(res);

	return filp;
Loading