Unionfs: branch-management bugfix to unionfs_file_revalidate
authorErez_Zadok <ezk@cs.sunysb.edu>
Fri, 16 Nov 2007 18:47:00 +0000 (13:47 -0500)
committerRachita Kothiyal <rachita@dewey.fsl.cs.sunysb.edu>
Thu, 1 May 2008 23:02:59 +0000 (19:02 -0400)
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 28518e1fd18dd054884fee4513fadbe6804f8f31..3e656376d94e704b90e31af270337ff23797f998 100644 (file)
@@ -437,11 +437,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 */