From: Uri Simchoni Date: Wed, 30 Mar 2016 10:00:29 +0000 (+0300) Subject: xfs-quota: do not fail if user has no quota X-Git-Tag: tdb-1.3.9~64 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ce82f66b9fdc611124f7284e32e44ed3df2d7295;p=thirdparty%2Fsamba.git xfs-quota: do not fail if user has no quota XFS fails quotactl(Q_XGETQUOTA) with ENOENT if the user or group has no quota assigned to it. This is not an error condition - simply report 0 quota in this case. Signed-off-by: Uri Simchoni Reviewed-by: Jeremy Allison --- diff --git a/source3/lib/sysquotas_xfs.c b/source3/lib/sysquotas_xfs.c index ccc7fc09111..bea86d5341d 100644 --- a/source3/lib/sysquotas_xfs.c +++ b/source3/lib/sysquotas_xfs.c @@ -90,16 +90,28 @@ int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt DEBUG(10,("sys_get_xfs_quota: path[%s] bdev[%s] SMB_USER_QUOTA_TYPE uid[%u]\n", path, bdev, (unsigned)id.uid)); - if ((ret=quotactl(QCMD(Q_XGETQUOTA,USRQUOTA), bdev, id.uid, (caddr_t)&D))) + ret=quotactl(QCMD(Q_XGETQUOTA,USRQUOTA), bdev, id.uid, (caddr_t)&D); + /* XFS fails with ENOENT if the user has no + * quota. Our protocol in that case is to + * succeed and return 0 as quota. + */ + if (ret != 0 && errno != ENOENT) { return ret; + } break; #ifdef HAVE_GROUP_QUOTA case SMB_GROUP_QUOTA_TYPE: DEBUG(10,("sys_get_xfs_quota: path[%s] bdev[%s] SMB_GROUP_QUOTA_TYPE gid[%u]\n", path, bdev, (unsigned)id.gid)); - if ((ret=quotactl(QCMD(Q_XGETQUOTA,GRPQUOTA), bdev, id.gid, (caddr_t)&D))) + ret=quotactl(QCMD(Q_XGETQUOTA,GRPQUOTA), bdev, id.gid, (caddr_t)&D); + /* XFS fails with ENOENT if the user has no + * quota. Our protocol in that case is to + * succeed and return 0 as quota. + */ + if (ret != 0 && errno != ENOENT) { return ret; + } break; #endif /* HAVE_GROUP_QUOTA */ case SMB_USER_FS_QUOTA_TYPE: