]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: setattr on inode (not path) if holding WR cap
authorSage Weil <sage@newdream.net>
Wed, 31 Dec 2008 19:19:38 +0000 (11:19 -0800)
committerSage Weil <sage@newdream.net>
Wed, 31 Dec 2008 19:19:38 +0000 (11:19 -0800)
For newly created files, this avoids contention in the MDS over the dentry
xlock (e.g., for an untar).

It is slightly risky, because we could race with a caps release and MDS
cache trim.  Pretty unlikely, however, because cap release would also
involve MDS journaling.

src/kernel/inode.c

index 6a7d36e2bed8fc6fa2d907548bda4ac76c636af5..faf01bfa3a10220be05b4d6a32ec5ce26090c4a1 100644 (file)
@@ -1415,8 +1415,10 @@ static struct ceph_mds_request *prepare_setattr(struct ceph_mds_client *mdsc,
        int pathlen;
        struct ceph_mds_request *req;
        u64 pathbase;
+       int issued = ceph_caps_issued(ceph_inode(dentry->d_inode));
 
-       if (ia_valid & ATTR_FILE) {
+       if ((ia_valid & ATTR_FILE) ||
+           (issued & (CEPH_CAP_WR|CEPH_CAP_WRBUFFER))) {
                dout(5, "prepare_setattr dentry %p (inode %llx.%llx)\n", dentry,
                     ceph_vinop(dentry->d_inode));
                req = ceph_mdsc_create_request(mdsc, op,