Unionfs: file_release must always succeed
authorErez Zadok <ezk@cs.sunysb.edu>
Fri, 19 Sep 2008 23:26:55 +0000 (19:26 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Fri, 19 Sep 2008 23:26:55 +0000 (19:26 -0400)
Why does f_op->release return an int if the VFS ignores it?!

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

index 92d207ec884d196d2b3c19551b7c5bb9afbb6dcb..d632b0a09485faa5cc29d9561803c667b25fc905 100644 (file)
@@ -659,15 +659,15 @@ int unionfs_file_release(struct inode *inode, struct file *file)
        unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
 
        /*
-        * Yes, we have to revalidate this file even if it's being released.
-        * This is important for open-but-unlinked files, as well as mmap
-        * support.
+        * We try to revalidate, but the VFS ignores return return values
+        * from file->release, so we must always try to succeed here,
+        * including to do the kfree and dput below.  So if revalidation
+        * failed, all we can do is print some message and keep going.
         */
        err = unionfs_file_revalidate(file, parent,
                                      UNIONFS_F(file)->wrote_to_file);
-       if (unlikely(err))
-               goto out;
-       unionfs_check_file(file);
+       if (!err)
+               unionfs_check_file(file);
        fileinfo = UNIONFS_F(file);
        BUG_ON(file->f_dentry->d_inode != inode);
        inodeinfo = UNIONFS_I(inode);
@@ -708,7 +708,6 @@ int unionfs_file_release(struct inode *inode, struct file *file)
        }
        kfree(fileinfo);
 
-out:
        unionfs_unlock_dentry(dentry);
        unionfs_unlock_parent(dentry, parent);
        unionfs_read_unlock(sb);