summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server/src
diff options
context:
space:
mode:
authorkrishna <ksriniva@redhat.com>2012-03-08 16:38:36 +0530
committerVijay Bellur <vijay@gluster.com>2012-03-11 22:59:35 -0700
commitb596986ca43b2acd83debe3c77607cc4e8ff1dc6 (patch)
treec6f072240da021005bef915f0a80a0a2e54e1d82 /xlators/nfs/server/src
parentef108d4fa77fd9aba48a7b9475c9b72352c16e6a (diff)
nfs/nlm: logging NFS client IP address when FH->volume mapping fails or when resolve_and_resume fails.
Change-Id: Ia89113f46c1d7c9ed629e9dc0ff0779c41ed947f BUG: 765259 Signed-off-by: krishna <ksriniva@redhat.com> Reviewed-on: http://review.gluster.com/2900 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/nfs/server/src')
-rw-r--r--xlators/nfs/server/src/nfs3.c39
-rw-r--r--xlators/nfs/server/src/nlm4.c40
2 files changed, 57 insertions, 22 deletions
diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c
index 1cb8d07e6..69cd3f786 100644
--- a/xlators/nfs/server/src/nfs3.c
+++ b/xlators/nfs/server/src/nfs3.c
@@ -216,14 +216,23 @@ out:
}
-#define nfs3_map_fh_to_volume(nfs3state, handle, rqst, volume, status, label) \
+#define nfs3_map_fh_to_volume(nfs3state, handle, req, volume, status, label) \
do { \
- char buf[256]; \
+ char exportid[256], gfid[256]; \
+ rpc_transport_t *trans = NULL; \
volume = nfs3_fh_to_xlator ((nfs3state), handle); \
if (!volume) { \
- uuid_unparse (handle->exportid, buf); \
+ uuid_unparse (handle->exportid, exportid); \
+ uuid_unparse (handle->gfid, gfid); \
+ trans = rpcsvc_request_transport (req); \
gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to map " \
- "FH to vol, exportid=%s", buf); \
+ "FH to vol: client=%s, exportid=%s, gfid=%s",\
+ trans->peerinfo.identifier, exportid, \
+ gfid); \
+ gf_log (GF_NFS3, GF_LOG_ERROR, \
+ "Stale nfs client %s must be trying to "\
+ "connect to a deleted volume, please " \
+ "unmount it.", trans->peerinfo.identifier);\
status = NFS3ERR_STALE; \
goto label; \
} else { \
@@ -248,13 +257,15 @@ out:
#define nfs3_check_fh_resolve_status(cst, nfstat, erlabl) \
do { \
xlator_t *xlatorp = NULL; \
- char buf[256], gfid[256]; \
+ char buf[256], gfid[256]; \
+ rpc_transport_t *trans = NULL; \
if ((cst)->resolve_ret < 0) { \
+ trans = rpcsvc_request_transport (cst->req); \
xlatorp = nfs3_fh_to_xlator (cst->nfs3state, \
&cst->resolvefh); \
- uuid_unparse (cst->fh.gfid, gfid); \
- sprintf (buf, "%s : %s", xlatorp ? \
- xlatorp->name : "ERR", gfid); \
+ uuid_unparse (cst->resolvefh.gfid, gfid); \
+ sprintf (buf, "(%s) %s : %s", trans->peerinfo.identifier,\
+ xlatorp ? xlatorp->name : "ERR", gfid); \
gf_log (GF_NFS3, GF_LOG_ERROR, "Unable to resolve FH"\
": %s", buf); \
nfstat = nfs3_errno_to_nfsstat3 (cst->resolve_errno);\
@@ -265,14 +276,16 @@ out:
#define nfs3_check_new_fh_resolve_status(cst, nfstat, erlabl) \
do { \
xlator_t *xlatorp = NULL; \
- char buf[256], gfid[256]; \
+ char buf[256], gfid[256]; \
+ rpc_transport_t *trans = NULL; \
if (((cst)->resolve_ret < 0) && \
((cst)->resolve_errno != ENOENT)) { \
+ trans = rpcsvc_request_transport (cst->req); \
xlatorp = nfs3_fh_to_xlator (cst->nfs3state, \
- &cst->resolvefh); \
- uuid_unparse (cst->fh.gfid, gfid); \
- sprintf (buf, "%s : %s", xlatorp ? \
- xlatorp->name : "ERR", gfid); \
+ &cst->resolvefh); \
+ uuid_unparse (cst->resolvefh.gfid, gfid); \
+ sprintf (buf, "(%s) %s : %s", trans->peerinfo.identifier,\
+ xlatorp ? xlatorp->name : "ERR", gfid); \
gf_log (GF_NFS3, GF_LOG_ERROR, "Unable to resolve FH"\
": %s", buf); \
nfstat = nfs3_errno_to_nfsstat3 (cs->resolve_errno);\
diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c
index 170c994d5..0a0d26366 100644
--- a/xlators/nfs/server/src/nlm4.c
+++ b/xlators/nfs/server/src/nlm4.c
@@ -101,12 +101,23 @@ nfs3_call_state_init (struct nfs3_state *s, rpcsvc_request_t *req, xlator_t *v);
xlator_t *
nfs3_fh_to_xlator (struct nfs3_state *nfs3, struct nfs3_fh *fh);
-#define nlm4_map_fh_to_volume(nfs3state, handle, rqst, volume, status, label) \
+#define nlm4_map_fh_to_volume(nfs3state, handle, req, volume, status, label) \
do { \
- volume = nfs3_fh_to_xlator ((nfs3state), handle); \
+ char exportid[256], gfid[256]; \
+ rpc_transport_t *trans = NULL; \
+ volume = nfs3_fh_to_xlator ((nfs3state), &handle); \
if (!volume) { \
+ uuid_unparse (handle.exportid, exportid); \
+ uuid_unparse (handle.gfid, gfid); \
+ trans = rpcsvc_request_transport (req); \
gf_log (GF_NLM, GF_LOG_ERROR, "Failed to map " \
- "FH to vol"); \
+ "FH to vol: client=%s, exportid=%s, gfid=%s",\
+ trans->peerinfo.identifier, exportid, \
+ gfid); \
+ gf_log (GF_NLM, GF_LOG_ERROR, \
+ "Stale nfs client %s must be trying to "\
+ "connect to a deleted volume, please " \
+ "unmount it.", trans->peerinfo.identifier);\
status = nlm4_stale_fh; \
goto label; \
} else { \
@@ -126,10 +137,21 @@ nfs3_fh_to_xlator (struct nfs3_state *nfs3, struct nfs3_fh *fh);
} \
} while (0) \
-#define nlm4_check_fh_resolve_status(cst, _stat, erlabl) \
+#define nlm4_check_fh_resolve_status(cst, nfstat, erlabl) \
do { \
+ xlator_t *xlatorp = NULL; \
+ char buf[256], gfid[256]; \
+ rpc_transport_t *trans = NULL; \
if ((cst)->resolve_ret < 0) { \
- _stat = nlm4_errno_to_nlm4stat (cst->resolve_errno);\
+ trans = rpcsvc_request_transport (cst->req); \
+ xlatorp = nfs3_fh_to_xlator (cst->nfs3state, \
+ &cst->resolvefh); \
+ uuid_unparse (cst->resolvefh.gfid, gfid); \
+ sprintf (buf, "(%s) %s : %s", trans->peerinfo.identifier,\
+ xlatorp ? xlatorp->name : "ERR", gfid); \
+ gf_log (GF_NLM, GF_LOG_ERROR, "Unable to resolve FH"\
+ ": %s", buf); \
+ nfstat = nlm4_errno_to_nlm4stat (cst->resolve_errno);\
goto erlabl; \
} \
} while (0) \
@@ -753,7 +775,7 @@ nlm4svc_test (rpcsvc_request_t *req)
}
nlm4_validate_gluster_fh (&fh, stat, nlm4err);
- nlm4_map_fh_to_volume (cs->nfs3state, &fh, req, vol, stat, nlm4err);
+ nlm4_map_fh_to_volume (cs->nfs3state, fh, req, vol, stat, nlm4err);
if (nlm_grace_period) {
gf_log (GF_NLM, GF_LOG_WARNING, "NLM in grace period");
@@ -1309,7 +1331,7 @@ nlm4svc_lock (rpcsvc_request_t *req)
}
fh = cs->lockfh;
nlm4_validate_gluster_fh (&fh, stat, nlm4err);
- nlm4_map_fh_to_volume (cs->nfs3state, &fh, req, vol, stat, nlm4err);
+ nlm4_map_fh_to_volume (cs->nfs3state, fh, req, vol, stat, nlm4err);
if (nlm_grace_period && !cs->args.nlm4_lockargs.reclaim) {
gf_log (GF_NLM, GF_LOG_WARNING, "NLM in grace period");
@@ -1522,7 +1544,7 @@ nlm4svc_cancel (rpcsvc_request_t *req)
}
nlm4_validate_gluster_fh (&fh, stat, nlm4err);
- nlm4_map_fh_to_volume (cs->nfs3state, &fh, req, vol, stat, nlm4err);
+ nlm4_map_fh_to_volume (cs->nfs3state, fh, req, vol, stat, nlm4err);
if (nlm_grace_period) {
gf_log (GF_NLM, GF_LOG_WARNING, "NLM in grace period");
@@ -1621,7 +1643,7 @@ nlm4svc_unlock (rpcsvc_request_t *req)
}
nlm4_validate_gluster_fh (&fh, stat, nlm4err);
- nlm4_map_fh_to_volume (cs->nfs3state, &fh, req, vol, stat, nlm4err);
+ nlm4_map_fh_to_volume (cs->nfs3state, fh, req, vol, stat, nlm4err);
if (nlm_grace_period) {
gf_log (GF_NLM, GF_LOG_WARNING, "NLM in grace period");