diff options
author | Niels de Vos <ndevos@redhat.com> | 2015-10-30 09:56:49 +0100 |
---|---|---|
committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2015-10-30 09:20:30 -0700 |
commit | a4b44e872b7334e299853025e4faf9547ca18dfd (patch) | |
tree | 2532bf252f5b4652337030adac6c03f1c17e0ce1 /xlators/nfs | |
parent | c360e8d3e33ac02a3bdb11d16fa4f638fc7dea9c (diff) |
nfs : avoid invalid usage of `cs` variable in nfs fops
Due to changes from http://review.gluster.org/#/c/12162/ a path variable
is added to nfs3_log_common_res() and usually `cs->resolvedloc.path` is
passed for that. But in certain fop function `cs` may not filled due error
and when it is logged using nfs3_log_common_res() results in a crash.
This patch will fix the same.
Cherry picked from commit ee4f6175d1e1e6d6b82631d72c993db5691ad205:
> Change-Id: I5a709818923e7884bd04e329834ee352a1b3a58f
> BUG: 1276243
> Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
> Reviewed-on: http://review.gluster.org/12458
> Reviewed-by: Niels de Vos <ndevos@redhat.com>
> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
> Tested-by: Gluster Build System <jenkins@build.gluster.com>
> Reviewed-by: N Balachandran <nbalacha@redhat.com>
Change-Id: I5a709818923e7884bd04e329834ee352a1b3a58f
BUG: 1276244
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/12471
Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
Reviewed-by: N Balachandran <nbalacha@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators/nfs')
-rw-r--r-- | xlators/nfs/server/src/nfs3.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c index 75125652fcb..267795b92c9 100644 --- a/xlators/nfs/server/src/nfs3.c +++ b/xlators/nfs/server/src/nfs3.c @@ -1179,7 +1179,7 @@ nfs3err: if (ret < 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_SETATTR, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_setattr_reply (req, stat, NULL, NULL); nfs3_call_state_wipe (cs); /* Ret must be 0 after this so that the caller does not @@ -1523,7 +1523,7 @@ nfs3err: if (ret < 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_LOOKUP, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_lookup_reply (req, stat, NULL, NULL, NULL); nfs3_call_state_wipe (cs); /* Ret must be 0 after this so that the caller does not @@ -1679,7 +1679,7 @@ nfs3err: if (ret < 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_ACCESS, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_access_reply (req, stat, 0, 0); nfs3_call_state_wipe (cs); ret = 0; @@ -1827,7 +1827,7 @@ nfs3err: if (ret < 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_READLINK, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_readlink_reply (req, stat, NULL, NULL); nfs3_call_state_wipe (cs); /* Ret must be 0 after this so that the caller does not @@ -2041,7 +2041,7 @@ nfs3err: if (ret < 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_READ, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_read_reply (req, stat, 0, NULL,0, NULL, NULL, 0); nfs3_call_state_wipe (cs); ret = 0; @@ -2318,7 +2318,7 @@ nfs3err: if (ret < 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_WRITE, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_write_reply (req, stat, 0, stable, 0, NULL, NULL); nfs3_call_state_wipe (cs); ret = 0; @@ -2707,7 +2707,7 @@ nfs3err: if (ret < 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_CREATE, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_create_reply (req, stat, NULL, NULL, NULL, NULL); nfs3_call_state_wipe (cs); ret = 0; @@ -2922,7 +2922,7 @@ nfs3err: if (ret < 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_MKDIR, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_mkdir_reply (req, stat, NULL, NULL, NULL, NULL); nfs3_call_state_wipe (cs); ret = 0; @@ -3084,7 +3084,7 @@ nfs3err: if (ret < 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_SYMLINK, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_symlink_reply (req, stat, NULL, NULL, NULL, NULL); nfs3_call_state_wipe (cs); /* Ret must be 0 after this so that the caller does not @@ -3379,7 +3379,7 @@ nfs3err: if (ret < 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_MKNOD, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_mknod_reply (req, stat, NULL, NULL, NULL, NULL); /* Ret must be 0 after this so that the caller does not * also send an RPC reply. @@ -3548,7 +3548,7 @@ nfs3err: if (ret < 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_REMOVE, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_remove_reply (req, stat, NULL, NULL); nfs3_call_state_wipe (cs); /* Ret must be 0 after this so that the caller does not @@ -3700,7 +3700,7 @@ nfs3err: if (ret < 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_RMDIR, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_rmdir_reply (req, stat, NULL, NULL); nfs3_call_state_wipe (cs); /* Ret must be 0 after this so that the caller does not @@ -3912,7 +3912,7 @@ nfs3err: if (ret < 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_RENAME, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_rename_reply (req, stat, NULL, NULL, NULL, NULL, NULL); nfs3_call_state_wipe (cs); /* Ret must be 0 after this so that the caller does not @@ -4106,7 +4106,7 @@ nfs3err: if (ret < 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_LINK, stat, - -ret, cs->resolvedloc.path); + -ret, cs ? cs->pathname : NULL); nfs3_link_reply (req, stat, NULL, NULL, NULL); nfs3_call_state_wipe (cs); /* Ret must be 0 after this so that the caller does not @@ -4479,13 +4479,13 @@ nfs3err: if (maxcount == 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_READDIR, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_readdir_reply (req, stat, NULL, 0, NULL, NULL, 0, 0); } else { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_READDIRP, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_readdirp_reply (req, stat, NULL, 0, NULL, NULL, 0, 0, 0); } @@ -4713,7 +4713,7 @@ nfs3err: if (ret < 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_FSSTAT, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_fsstat_reply (req, stat, NULL, NULL); nfs3_call_state_wipe (cs); /* Ret must be 0 after this so that the caller does not @@ -4863,7 +4863,7 @@ nfs3err: if (ret < 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_FSINFO, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_fsinfo_reply (req, stat, NULL); nfs3_call_state_wipe (cs); ret = 0; @@ -5008,7 +5008,7 @@ nfs3err: if (ret < 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_PATHCONF, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_pathconf_reply (req, stat, NULL); nfs3_call_state_wipe (cs); /* Ret must be 0 after this so that the caller does not @@ -5204,7 +5204,7 @@ nfs3err: if (ret < 0) { nfs3_log_common_res (rpcsvc_request_xid (req), NFS3_COMMIT, stat, -ret, - cs->resolvedloc.path); + cs ? cs->resolvedloc.path : NULL); nfs3_commit_reply (req, stat, 0, NULL, NULL); nfs3_call_state_wipe (cs); ret = 0; |