Unionfs: bugfix when renaming symlinks on readonly branches
authorErez_Zadok <ezk@cs.sunysb.edu>
Sun, 8 Jul 2007 01:31:28 +0000 (21:31 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Fri, 29 Apr 2011 02:24:14 +0000 (22:24 -0400)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/copyup.c

index 64bb5ef3c3f0bbc9aa6d31973363b1c1f1c9087e..6ae2e5692842fa9c8c22e1be529f5a4398027e43 100644 (file)
@@ -385,7 +385,7 @@ int copyup_dentry(struct inode *dir, struct dentry *dentry, int bstart,
                        (char __user *)symbuf,
                        PATH_MAX);
                set_fs(oldfs);
-               if (err) {
+               if (err < 0) {
                        __clear(dentry, old_lower_dentry,
                                old_bstart, old_bend,
                                new_lower_dentry, new_bindex);
@@ -466,7 +466,8 @@ out_free:
         * functions we call above which operate on regular files.
         */
        if (old_lower_dentry && old_lower_dentry->d_inode &&
-           S_ISDIR(old_lower_dentry->d_inode->i_mode))
+           (S_ISDIR(old_lower_dentry->d_inode->i_mode) ||
+            S_ISLNK(old_lower_dentry->d_inode->i_mode)))
                dput(old_lower_dentry);
        kfree(symbuf);