]> err.no Git - linux-2.6/commitdiff
[XFS] Fix a project quota space accounting leak on rename.
authorNathan Scott <nathans@sgi.com>
Mon, 8 May 2006 09:51:42 +0000 (19:51 +1000)
committerNathan Scott <nathans@sgi.com>
Mon, 8 May 2006 09:51:42 +0000 (19:51 +1000)
SGI-PV: 951636
SGI-Modid: xfs-linux-melb:xfs-kern:25811a

Signed-off-by: Nathan Scott <nathans@sgi.com>
fs/xfs/xfs_rename.c
fs/xfs/xfs_vnodeops.c

index 81a05cfd77d2b5f60fa2429366ae07af19ca4843..1f148762eb28e01b7854e4e7d412242a0e8c6cec 100644 (file)
@@ -316,6 +316,18 @@ xfs_rename(
                }
        }
 
+       /*
+        * If we are using project inheritance, we only allow renames
+        * into our tree when the project IDs are the same; else the
+        * tree quota mechanism would be circumvented.
+        */
+       if (unlikely((target_dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
+                    (target_dp->i_d.di_projid != src_ip->i_d.di_projid))) {
+               error = XFS_ERROR(EXDEV);
+               xfs_rename_unlock4(inodes, XFS_ILOCK_SHARED);
+               goto rele_return;
+       }
+
        new_parent = (src_dp != target_dp);
        src_is_directory = ((src_ip->i_d.di_mode & S_IFMT) == S_IFDIR);
 
index fa71b305ba5c0e56231fb48ec57eed1f16f4b0e6..7027ae68ee38e6491897eb88033886b7c6fb0ea5 100644 (file)
@@ -2663,7 +2663,7 @@ xfs_link(
         */
        if (unlikely((tdp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
                     (tdp->i_d.di_projid != sip->i_d.di_projid))) {
-               error = XFS_ERROR(EPERM);
+               error = XFS_ERROR(EXDEV);
                goto error_return;
        }