]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: fix queue_cap_snap refs, calls in handle_snap
authorSage Weil <sage@newdream.net>
Wed, 29 Jul 2009 22:51:54 +0000 (15:51 -0700)
committerSage Weil <sage@newdream.net>
Thu, 30 Jul 2009 22:25:02 +0000 (15:25 -0700)
Call on correct ci.  Skip past dropping inodes without dropping
our spinlock.  Hold ref on prior inode until we traverse to the
next one.  (We can't iput while holding our spinlock.)

src/kernel/snap.c

index e07d77656d1f2e820fa153a91b6d32aa0c0dc268..b349612ea94df24ee30491f67aa6cd2d7d251c7b 100644 (file)
@@ -560,20 +560,24 @@ more:
                 */
                if (!deletion) {
                        struct ceph_inode_info *ci;
+                       struct inode *lastinode = NULL;
 
                        spin_lock(&realm->inodes_with_caps_lock);
                        list_for_each_entry(ci, &realm->inodes_with_caps,
                                            i_snap_realm_item) {
                                struct inode *inode = igrab(&ci->vfs_inode);
+                               if (!inode)
+                                       continue;
                                spin_unlock(&realm->inodes_with_caps_lock);
-                               if (inode) {
-                                       ceph_queue_cap_snap(ci,
-                                                   realm->cached_context);
-                                       iput(inode);
-                               }
+                               if (lastinode)
+                                       iput(lastinode);
+                               lastinode = inode;
+                               ceph_queue_cap_snap(ci, realm->cached_context);
                                spin_lock(&realm->inodes_with_caps_lock);
                        }
                        spin_unlock(&realm->inodes_with_caps_lock);
+                       if (lastinode)
+                               iput(lastinode);
                        dout("update_snap_trace cap_snaps queued\n");
                }