Unionfs: branch-management bugfix to unionfs_file_revalidate
authorErez_Zadok <ezk@cs.sunysb.edu>
Sat, 21 Jul 2007 06:38:14 +0000 (02:38 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Sun, 6 Mar 2011 08:42:35 +0000 (03:42 -0500)
If we re-opened the file on a different branch than the original one, and
only if this was due to a new branch inserted, then update the mnt counts of
the old and new branches accordingly.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/commonfops.c

index f6f7deaf06bbffc9a21a193b279514eee995ee31..baa6a3725ee0bc8003ee1b3b74f6fba157406eee 100644 (file)
@@ -370,11 +370,12 @@ int unionfs_file_revalidate(struct file *file, int willwrite)
                                goto out;
                        new_brid = UNIONFS_F(file)->
                          saved_branch_ids[fbstart(file)];
-                       if (new_brid != orig_brid) {
+                       if (new_brid != orig_brid && sbgen > fgen) {
                                /*
                                 * If we re-opened the file on a different
-                                * branch than the original one, then update
-                                * the mnt counts of the old and new
+                                * branch than the original one, and this
+                                * was due to a new branch inserted, then
+                                * update the mnt counts of the old and new
                                 * branches accordingly.
                                 */
                                unionfs_mntget(dentry, bstart); /* new branch */