From: Sage Weil Date: Wed, 31 Dec 2008 19:19:38 +0000 (-0800) Subject: kclient: setattr on inode (not path) if holding WR cap X-Git-Tag: v0.6~1^2~191 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9a3988e4f7ed6e0c6f41a62037c55cf0c3025f4d;p=ceph.git kclient: setattr on inode (not path) if holding WR cap 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. --- diff --git a/src/kernel/inode.c b/src/kernel/inode.c index 6a7d36e2bed..faf01bfa3a1 100644 --- a/src/kernel/inode.c +++ b/src/kernel/inode.c @@ -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,