diff options
author | Santosh Kumar Pradhan <spradhan@redhat.com> | 2013-09-20 16:58:47 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-11-04 17:33:37 -0800 |
commit | 0b2487d3bc8bc526d9b08698ea1434e94a6420d5 (patch) | |
tree | 8c49c921954060d88ad9109d71736823b26b3723 /xlators/nfs/server/src/nfs3-helpers.c | |
parent | 3108d4529d57690f58027da61ac5e56a0987ed57 (diff) |
gNFS: NFS segfaults with nfstest_posix tool
Problem:
nfs3_stat_to_fattr3() missed a NULL check.
FIX:
(1) Added a NULL check.
(2) In all fop cbk path, if the op_ret is -1 and op_errno is 0,
then handle it as a special case. Set the NFS3 status as
NFS3ERR_SERVERFAULT instead of NFS3_OK.
(3) The other component of FIX would be in DHT module and
is on the way.
Change-Id: I6f03c9a02d794f8b807574f2755094dab1b90c92
BUG: 1010241
Signed-off-by: Santosh Kumar Pradhan <spradhan@redhat.com>
Reviewed-on: http://review.gluster.org/6026
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/nfs/server/src/nfs3-helpers.c')
-rw-r--r-- | xlators/nfs/server/src/nfs3-helpers.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/xlators/nfs/server/src/nfs3-helpers.c b/xlators/nfs/server/src/nfs3-helpers.c index 824b9226cb2..e299bad31c6 100644 --- a/xlators/nfs/server/src/nfs3-helpers.c +++ b/xlators/nfs/server/src/nfs3-helpers.c @@ -275,6 +275,9 @@ nfs3_stat_to_fattr3 (struct iatt *buf) { fattr3 fa = {0, }; + if (buf == NULL) + goto out; + if (IA_ISDIR (buf->ia_type)) fa.type = NF3DIR; else if (IA_ISREG (buf->ia_type)) @@ -344,6 +347,7 @@ nfs3_stat_to_fattr3 (struct iatt *buf) fa.mtime.seconds = buf->ia_mtime; fa.mtime.nseconds = buf->ia_mtime_nsec; +out: return fa; } |