All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] don't rename file into dummy directory
@ 2009-09-24  9:08 Yan, Zheng
  0 siblings, 0 replies; only message in thread
From: Yan, Zheng @ 2009-09-24  9:08 UTC (permalink / raw)
  To: linux-btrfs, chris Mason

A recently change enforces there is 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>

---
diff -urp 1/fs/btrfs/inode.c 2/fs/btrfs/inode.c
--- 1/fs/btrfs/inode.c	2009-09-23 05:49:42.007477065 +0800
+++ 2/fs/btrfs/inode.c	2009-09-23 09:46:22.451357089 +0800
@@ -5057,6 +5057,9 @@ static int btrfs_rename(struct inode *ol
 	u64 root_objectid;
 	int ret;
 
+	if (new_dir->i_ino == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)
+		return -EPERM;
+
 	/* we only allow rename subvolume link between subvolumes */
 	if (old_inode->i_ino != BTRFS_FIRST_FREE_OBJECTID && root != dest)
 		return -EXDEV;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-09-24  9:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-24  9:08 [PATCH] don't rename file into dummy directory Yan, Zheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.