On Sat, Aug 11, 2018 at 12:17 AM Gregory Farnum <gfarnum@xxxxxxxxxx> wrote: > > This needs to be consistent across kernel- and user-space, and I > believe we settled on continuing to allow cross-quota links (despite > the accounting issues) because otherwise the introduction of new > quotas makes it incredibly messy. Unless I missed a change, Zheng? > -Greg > I agree with Greg Regards Yan, Zheng > On Fri, Aug 10, 2018 at 2:57 AM, Chengguang Xu <cgxu519@xxxxxxx> wrote: > > 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 > >