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

James Simmons jsimmons at infradead.org
Wed Aug 3 18:38:01 PDT 2022


From: Sebastien Buisson <sbuisson at 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 at ddn.com>
Reviewed-on: https://review.whamcloud.com/46149
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: James Simmons <jsimmons at infradead.org>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 fs/lustre/ptlrpc/import.c | 4 ++--
 fs/lustre/ptlrpc/niobuf.c | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

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);
-- 
1.8.3.1



More information about the lustre-devel mailing list