]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: fix file reopen on existing caps
authorSage Weil <sage@newdream.net>
Fri, 13 Mar 2009 20:40:13 +0000 (13:40 -0700)
committerSage Weil <sage@newdream.net>
Fri, 13 Mar 2009 20:43:40 +0000 (13:43 -0700)
We can do a local open only if the MDS already knows we want
those caps.  It doesn't actually matter if they're currently
issued to us (there may be a concurrent something-or-other going
on, but we'll get them back eventually).

src/kernel/file.c

index ad008255329b776b340d204ff7bd33f211fce587..a5e429618647095d5d5fcfed930caf6b4db2a686 100644 (file)
@@ -105,9 +105,13 @@ int ceph_open(struct inode *inode, struct file *file)
        fmode = ceph_flags_to_mode(flags);
        wantcaps = ceph_caps_for_mode(fmode);
 
-       /* can we re-use existing caps? */
+       /*
+        * We re-use existing caps only if already have an open file
+        * that also wants them.  That is, our want for the caps is
+        * registered with the MDS.
+        */
        spin_lock(&inode->i_lock);
-       if ((__ceph_caps_issued(ci, NULL) & wantcaps) == wantcaps) {
+       if ((__ceph_caps_file_wanted(ci) & wantcaps) == wantcaps) {
                dout(10, "open fmode %d caps %d using existing on %p\n",
                     fmode, wantcaps, inode);
                __ceph_get_fmode(ci, fmode);