Unionfs: revalidate files which are open but unlinked
authorErez Zadok <ezk@cs.sunysb.edu>
Sat, 30 Apr 2011 05:33:57 +0000 (01:33 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Fri, 12 Aug 2011 02:39:32 +0000 (22:39 -0400)
Need to re-open the file if the starting dentry is on a higher priority
branch than the currently opened file (which could happen when we ftruncate
an opened, but unlinked file).

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

index 51ea65e82b4772287084ae62090e7410c765e37d..77ddfe4632c888acc199e8cb9561f3e1d0c80a4c 100644 (file)
@@ -312,7 +312,7 @@ static int __unionfs_file_revalidate(struct file *file, struct dentry *dentry,
         * someone has copied up this file from underneath us, we also need
         * to refresh things.
         */
-       if (d_deleted(dentry) ||
+       if ((d_deleted(dentry) && dbstart(dentry) >= fbstart(file)) ||
            (sbgen <= fgen &&
             dbstart(dentry) == fbstart(file) &&
             unionfs_lower_file(file)))