[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.1203282211360.9468@cobra.newdream.net>
Date: Wed, 28 Mar 2012 22:23:56 -0700 (PDT)
From: Sage Weil <sage@...dream.net>
To: Miklos Szeredi <miklos@...redi.hu>
cc: viro@...IV.linux.org.uk, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, hch@...radead.org,
Trond.Myklebust@...app.com, sfrench@...ba.org, ericvh@...il.com,
mszeredi@...e.cz
Subject: Re: [PATCH 13/16] ceph: implement i_op->atomic_open() and
i_op->atomic_create()
Hi Miklos,
I was pleasantly surprised to find that this works as-is. I simplified
this to call ceph_lookup_open for the atomic O_CREAT case as well, and it
passes my basic battery of tests. An incremental patch is below.
I haven't looked closely at the vfs bits, but from an fs perspective this
series looks good to me!
Thanks-
sage
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 75df600..9d679dd 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -642,37 +642,17 @@ struct file *ceph_atomic_open(struct inode *dir, struct dentry *dentry,
struct dentry *res = NULL;
struct file *filp;
- if (!(flags & O_CREAT)) {
- if (dentry->d_name.len > NAME_MAX)
- return ERR_PTR(-ENAMETOOLONG);
-
- err = ceph_init_dentry(dentry);
- if (err < 0)
- return ERR_PTR(err);
-
- return ceph_lookup_open(dir, dentry, od, flags, mode);
- }
-
- if (d_unhashed(dentry)) {
- res = ceph_lookup(dir, dentry, NULL);
- if (IS_ERR(res))
- return ERR_CAST(res);
-
- if (res)
- dentry = res;
- }
+ dout("atomic_open %p dentry %p '%.*s'\n",
+ dir, dentry, dentry->d_name.len, dentry->d_name.name);
- /* We don't deal with positive dentries here */
- if (dentry->d_inode) {
- finish_no_open(od, res);
- return NULL;
- }
+ if (dentry->d_name.len > NAME_MAX)
+ return ERR_PTR(-ENAMETOOLONG);
- *created = true;
- filp = ceph_lookup_open(dir, dentry, od, flags, mode);
- dput(res);
+ err = ceph_init_dentry(dentry);
+ if (err < 0)
+ return ERR_PTR(err);
- return filp;
+ return ceph_lookup_open(dir, dentry, od, flags, mode);
}
/*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists