Merge branch 'akpm' (patches from Andrew)
[linux-2.6-microblaze.git] / fs / namei.c
index d049d39..95a881e 100644 (file)
@@ -4089,7 +4089,9 @@ int vfs_unlink(struct user_namespace *mnt_userns, struct inode *dir,
                return -EPERM;
 
        inode_lock(target);
-       if (is_local_mountpoint(dentry))
+       if (IS_SWAPFILE(target))
+               error = -EPERM;
+       else if (is_local_mountpoint(dentry))
                error = -EBUSY;
        else {
                error = security_inode_unlink(dir, dentry);
@@ -4597,6 +4599,10 @@ int vfs_rename(struct renamedata *rd)
        else if (target)
                inode_lock(target);
 
+       error = -EPERM;
+       if (IS_SWAPFILE(source) || (target && IS_SWAPFILE(target)))
+               goto out;
+
        error = -EBUSY;
        if (is_local_mountpoint(old_dentry) || is_local_mountpoint(new_dentry))
                goto out;