diff options
author | Jiffin Tony Thottan <jthottan@redhat.com> | 2015-10-29 12:29:04 +0530 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2015-10-30 01:54:53 -0700 |
commit | ee4f6175d1e1e6d6b82631d72c993db5691ad205 (patch) | |
tree | 9ab14d2dac31d9bc935932a3400425d82e222d25 | |
parent | b191047eb21be0dfc28c7d93db88db46ed1655bd (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.
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>
-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 6b31c6462e0..e2650551814 100644 --- a/xlators/nfs/server/src/nfs3.c +++ b/xlators/nfs/server/src/nfs3.c @@ -1174,7 +1174,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 @@ -1518,7 +1518,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 @@ -1674,7 +1674,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; @@ -1822,7 +1822,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 @@ -2036,7 +2036,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; @@ -2313,7 +2313,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; @@ -2702,7 +2702,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; @@ -2917,7 +2917,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; @@ -3079,7 +3079,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 @@ -3374,7 +3374,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. @@ -3543,7 +3543,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 @@ -3695,7 +3695,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 @@ -3907,7 +3907,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 @@ -4101,7 +4101,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 @@ -4474,13 +4474,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); } @@ -4708,7 +4708,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 @@ -4858,7 +4858,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; @@ -5003,7 +5003,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 @@ -5199,7 +5199,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; |