summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorKinglong Mee <mijinlong@open-fs.com>2018-03-13 06:50:48 -0400
committerKinglong Mee <kinglongmee@gmail.com>2018-04-09 14:29:02 +0800
commitf946d98a95249c8d906323e6419ec8538467d2ab (patch)
tree4ad9b43750d18744817dfaa136d9d7584e2c0e51 /xlators
parent6964640a977cb10c0c95a94e03c229918fa6eca8 (diff)
quota: allow writes when with EINVAL on pgfid isnot exist
NFS client gets "Invalid argument" when writing file through nfs-ganesha. 1. With quota disabled; nfs client mount nfs-ganesha share, and do 'll' in the testing directory. 2. Enable quota; getfattr: Removing leading '/' from absolute path names trusted.gfid=0xe2edaac0eca8420ebbbcba7e56bbd240 trusted.gfid2path.b3250af8fa558e66=0x39663134343566662d653530332d343831352d396635312d3236633565366332633137642f7465737466696c653932 trusted.glusterfs.quota.9f1445ff-e503-4815-9f51-26c5e6c2c17d.contri.3=0x00000000000002000000000000000001 Notice: testfile92 without trusted.pgfid xattr. 3. restart glusterfs volume by "gluster volume stop/start gvtest" 4. echo somedata > testfile92 5. ll testfile92 -rw-r--r-- 1 root root 0 Mar 6 21:43 testfile92 BUG: 1560319 Change-Id: Iaa4dd1e891c99069fb85b7b11bb0482cbf2303b1 fixes: bz#1560319 Signed-off-by: Kinglong Mee <mijinlong@open-fs.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/quota/src/quota.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index 6ef2e20cf61..cd7f0147d75 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -1758,6 +1758,7 @@ out:
return 0;
}
+static int gf_quota_enforcer_log;
int32_t
quota_writev_helper (call_frame_t *frame, xlator_t *this, fd_t *fd,
@@ -1809,6 +1810,26 @@ quota_writev_helper (call_frame_t *frame, xlator_t *this, fd_t *fd,
"with ENOENT/ESTALE on %s, cannot check "
"quota limits and allowing writes",
uuid_utoa (fd->inode->gfid));
+ } else if ((op_errno == EINVAL) &&
+ !inode_parent (local->loc.inode, 0, NULL)) {
+ /* We may get INVAL with parent == NULL,
+ * in case of below scenario
+ * 1. enable quota
+ * 2. glusterfsd stop/start
+ * 3. nameless lookup
+ * 4. write on fd
+ * Here build_ancestry can fail as the file's pgfid
+ * is't exist.
+ * For now ignore EINVAL with writes on active fd
+ * untils the pgfid is created at name lookup
+ */
+ GF_LOG_OCCASIONALLY (gf_quota_enforcer_log, this->name,
+ GF_LOG_CRITICAL, "Quota cannot be enforced as "
+ "parent is not available and writes are being "
+ "allowed without checking whether they are "
+ "within quota limits. This can happen if Quota "
+ "crawl is not complete. If crawl has been "
+ "completed, please file a bug.");
} else {
goto unwind;
}