]> git.neil.brown.name Git - LaFS.git/commitdiff
lafs_get_subset: balance locks properly
authorNeilBrown <neilb@suse.de>
Fri, 13 Aug 2010 06:09:53 +0000 (16:09 +1000)
committerNeilBrown <neilb@suse.de>
Fri, 13 Aug 2010 06:09:53 +0000 (16:09 +1000)
We drop the mutex outside the 'if' so we must take it outside
the 'if' too - which is safer as well.

Signed-off-by: NeilBrown <neilb@suse.de>
super.c

diff --git a/super.c b/super.c
index 5df896f949ef72988c71d7aa0d5e78fb2795f708..7dabfd6034801e66bb578cc6b2277e8500763647 100644 (file)
--- a/super.c
+++ b/super.c
@@ -968,12 +968,12 @@ lafs_get_subset(struct file_system_type *fs_type,
            LAFSI(ino)->type != TypeDir)
                goto out;
        fs = fs_from_sb(sb);
+       mutex_lock(&ino->i_mutex);
        if (LAFSI(ino)->type == TypeDir) {
                struct datablock *inodb;
                /* maybe convert this to TypeInodeFile */
                if (sb->s_type != &lafs_fs_type)
-                       goto out;
-               mutex_lock(&ino->i_mutex);
+                       goto out_unlock;
                if (ino->i_size)
                        /* FIXME maybe I should run orphans */
                        goto out_unlock;