diff mbox series

[16/32] lustre: sec: handle read-only flag

Message ID 1659577097-19253-17-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: Update to OpenSFS as of Aug 3 2022 | expand

Commit Message

James Simmons Aug. 4, 2022, 1:38 a.m. UTC
From: Sebastien Buisson <sbuisson@ddn.com>

Add a new 'readonly_mount' property to nodemaps on the server
side. When this property is set, we return -EROFS from server
side if the client is not mounting read-only. So the client
will have to specify the read-only mount option to be allowed
to mount.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15451
Lustre-commit: e7ce67de92dea6870 ("LU-15451 sec: read-only nodemap flag")
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-on: https://review.whamcloud.com/46149
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/ptlrpc/import.c | 4 ++--
 fs/lustre/ptlrpc/niobuf.c | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/fs/lustre/ptlrpc/import.c b/fs/lustre/ptlrpc/import.c
index a5fdb8a8..697b3c3 100644
--- a/fs/lustre/ptlrpc/import.c
+++ b/fs/lustre/ptlrpc/import.c
@@ -1306,10 +1306,10 @@  static int ptlrpc_connect_interpret(const struct lu_env *env,
 		time64_t next_connect;
 
 		import_set_state_nolock(imp, LUSTRE_IMP_DISCON);
-		if (rc == -EACCES) {
+		if (rc == -EACCES || rc == -EROFS) {
 			/*
 			 * Give up trying to reconnect
-			 * EACCES means client has no permission for connection
+			 * EROFS means client must mount read-only
 			 */
 			imp->imp_obd->obd_no_recov = 1;
 			ptlrpc_deactivate_import_nolock(imp);
diff --git a/fs/lustre/ptlrpc/niobuf.c b/fs/lustre/ptlrpc/niobuf.c
index 94a0329..be1811a 100644
--- a/fs/lustre/ptlrpc/niobuf.c
+++ b/fs/lustre/ptlrpc/niobuf.c
@@ -472,7 +472,8 @@  int ptlrpc_send_error(struct ptlrpc_request *req, int may_be_difficult)
 
 	if (req->rq_status != -ENOSPC && req->rq_status != -EACCES &&
 	    req->rq_status != -EPERM && req->rq_status != -ENOENT &&
-	    req->rq_status != -EINPROGRESS && req->rq_status != -EDQUOT)
+	    req->rq_status != -EINPROGRESS && req->rq_status != -EDQUOT &&
+	    req->rq_status != -EROFS)
 		req->rq_type = PTL_RPC_MSG_ERR;
 
 	rc = ptlrpc_send_reply(req, may_be_difficult);