summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtests/bugs/bug-915280.t51
-rw-r--r--tests/volume.rc10
-rw-r--r--xlators/nfs/server/src/acl3.c26
3 files changed, 77 insertions, 10 deletions
diff --git a/tests/bugs/bug-915280.t b/tests/bugs/bug-915280.t
new file mode 100755
index 000000000..a1f92f201
--- /dev/null
+++ b/tests/bugs/bug-915280.t
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+
+cleanup;
+
+TEST glusterd
+TEST pidof glusterd
+
+function volinfo_field()
+{
+ local vol=$1;
+ local field=$2;
+
+ $CLI volume info $vol | grep "^$field: " | sed 's/.*: //';
+}
+
+TEST $CLI volume create $V0 $H0:$B0/brick1 $H0:$B0/brick2;
+EXPECT 'Created' volinfo_field $V0 'Status';
+
+TEST $CLI volume start $V0;
+EXPECT 'Started' volinfo_field $V0 'Status';
+
+sleep 3
+
+MOUNTDIR=$N0;
+TEST mount -t nfs -o vers=3,nolock,soft,timeo=30,retrans=1 $H0:/$V0 $N0
+TEST touch $N0/testfile
+
+TEST $CLI volume set $V0 debug.error-gen client
+TEST $CLI volume set $V0 debug.error-fops stat
+TEST $CLI volume set $V0 debug.error-failure 100
+
+sleep 1
+
+pid_file=$(read_nfs_pidfile);
+
+getfacl $N0/testfile 2>/dev/null
+
+nfs_pid=$(get_nfs_pid);
+if [ ! $nfs_pid ]
+then
+ nfs_pid=0;
+fi
+
+TEST [ $nfs_pid -eq $pid_file ]
+
+TEST umount $MOUNTDIR -l
+
+cleanup;
diff --git a/tests/volume.rc b/tests/volume.rc
index 9debe2b99..1b9f8b2c8 100644
--- a/tests/volume.rc
+++ b/tests/volume.rc
@@ -39,6 +39,16 @@ function get_mount_process_pid {
ps aux | grep glusterfs | grep -E "volfile-id[ =]/?$vol " | awk '{print $2}' | head -1
}
+function get_nfs_pid ()
+{
+ ps aux | grep "volfile-id\ gluster\/nfs" | awk '{print $2}' | head -1
+}
+
+function read_nfs_pidfile ()
+{
+ echo `cat /var/lib/glusterd/nfs/run/nfs.pid`
+}
+
function cleanup_statedump {
pid=$1
rm -f $statedumpdir/*$pid.dump.*
diff --git a/xlators/nfs/server/src/acl3.c b/xlators/nfs/server/src/acl3.c
index 46431a475..ed60775ab 100644
--- a/xlators/nfs/server/src/acl3.c
+++ b/xlators/nfs/server/src/acl3.c
@@ -126,9 +126,9 @@ nfs3_fh_to_xlator (struct nfs3_state *nfs3, struct nfs3_fh *fh);
do { \
calls = nfs3_call_state_init ((nfs3state), (rq), v); \
if (!calls) { \
- gf_log (GF_NLM, GF_LOG_ERROR, "Failed to " \
+ gf_log (GF_ACL, GF_LOG_ERROR, "Failed to " \
"init call state"); \
- opstat = nlm4_failed; \
+ opstat = NFS3ERR_SERVERFAULT; \
rpcsvc_request_seterr (req, SYSTEM_ERR); \
goto errlabel; \
} \
@@ -229,12 +229,14 @@ acl3_getacl_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
getaclreply *getaclreply = NULL;
cs = frame->local;
+ if (cs)
+ getaclreply = &cs->args.getaclreply;
+
if (op_ret == -1) {
stat = nfs3_errno_to_nfsstat3 (op_errno);
goto err;
}
- getaclreply = &cs->args.getaclreply;
getaclreply->aclentry.aclentry_val = cs->aclentry;
getaclreply->daclentry.daclentry_val = cs->daclentry;
@@ -271,7 +273,8 @@ acl3_getacl_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
return 0;
err:
- getaclreply->status = stat;
+ if (getaclreply)
+ getaclreply->status = stat;
acl3_getacl_reply (cs, getaclreply);
nfs3_call_state_wipe (cs);
return 0;
@@ -289,13 +292,14 @@ acl3_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
nfs_user_t nfu = {0, };
cs = frame->local;
+ if (cs)
+ getaclreply = &cs->args.getaclreply;
+
if (op_ret == -1) {
stat = nfs3_errno_to_nfsstat3 (op_errno);
goto err;
}
- getaclreply = &cs->args.getaclreply;
-
getaclreply->attr_follows = 1;
getaclreply->attr = nfs3_stat_to_fattr3 (buf);
getaclreply->mask = 0xf;
@@ -377,7 +381,7 @@ acl3svc_getacl (rpcsvc_request_t *req)
vol, stat, rpcerr);
cs->vol = vol;
- acl3_volume_started_check (nfs3, vol, ret, rpcerr);
+ acl3_volume_started_check (nfs3, vol, ret, acl3err);
ret = nfs3_fh_resolve_and_resume (cs, fhp,
NULL, acl3_getacl_resume);
@@ -385,9 +389,11 @@ acl3svc_getacl (rpcsvc_request_t *req)
acl3err:
if (ret < 0) {
gf_log (GF_ACL, GF_LOG_ERROR, "unable to resolve and resume");
- cs->args.getaclreply.status = stat;
- acl3_getacl_reply (cs, &cs->args.getaclreply);
- nfs3_call_state_wipe (cs);
+ if (cs) {
+ cs->args.getaclreply.status = stat;
+ acl3_getacl_reply (cs, &cs->args.getaclreply);
+ nfs3_call_state_wipe (cs);
+ }
return 0;
}