aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorYan, Zheng <zheng.yan@oracle.com>2009-09-24 09:17:31 -0400
committerChris Mason <chris.mason@oracle.com>2009-09-24 09:17:31 -0400
commitf679a84034be6f7da123be786bbd8838bf3e9207 (patch)
tree4dce1760675978fd0b113e04f9608f57161bac85 /fs/btrfs
parenta57195214358b75807a74bad96a8601a36262af7 (diff)
Btrfs: don't rename file into dummy directory
A recent change enforces only one access point to each subvolume. The first directory entry (the one added when the subvolume/snapshot was created) is treated as valid access point, all other subvolume links are linked to dummy empty directories. The dummy directories are temporary inodes that only in memory, so we can not rename file into them. Signed-off-by: Yan Zheng <zheng.yan@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/inode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 19fcde289dd9..01c5f8b5a34e 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5055,6 +5055,9 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
5055 u64 root_objectid; 5055 u64 root_objectid;
5056 int ret; 5056 int ret;
5057 5057
5058 if (new_dir->i_ino == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)
5059 return -EPERM;
5060
5058 /* we only allow rename subvolume link between subvolumes */ 5061 /* we only allow rename subvolume link between subvolumes */
5059 if (old_inode->i_ino != BTRFS_FIRST_FREE_OBJECTID && root != dest) 5062 if (old_inode->i_ino != BTRFS_FIRST_FREE_OBJECTID && root != dest)
5060 return -EXDEV; 5063 return -EXDEV;