[PATCH] ceph: don't allow cross-quota link

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently, we allow making hard link bewteen different
quota realms and it may cause inaccurate quota accouting.
This patch adds quota realm check when doing hard link.

Signed-off-by: Chengguang Xu <cgxu519@xxxxxxx>
---
 fs/ceph/dir.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 82928cea0209..87fa996dbad4 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -993,6 +993,10 @@ static int ceph_link(struct dentry *old_dentry, struct inode *dir,
 	if (ceph_snap(dir) != CEPH_NOSNAP)
 		return -EROFS;
 
+	/* don't allow cross-quota link */
+	if (!ceph_quota_is_same_realm(d_inode(old_dentry), dir))
+		return -EXDEV;
+
 	dout("link in dir %p old_dentry %p dentry %p\n", dir,
 	     old_dentry, dentry);
 	req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LINK, USE_AUTH_MDS);
-- 
2.17.1




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux