Linux-CIFS Archive on lore.kernel.org
 help / color / Atom feed
* [SMB3][PATCH] Add more detailed log information on cache=ro mounts
@ 2019-08-30  3:39 Steve French
  2019-08-30  3:57 ` ronnie sahlberg
  0 siblings, 1 reply; 2+ messages in thread
From: Steve French @ 2019-08-30  3:39 UTC (permalink / raw)
  To: CIFS

[-- Attachment #1: Type: text/plain, Size: 752 bytes --]

Make it easier to tell if the share we are mounting with cache=ro is
considered read only by the server.  Obviously there are cases where
the user could know that no one will be writing to the share but this
additional information could be helpful.

$ dmesg
[374786.661113] CIFS: Attempting to mount //localhost/test
[374786.661130] CIFS VFS: mounting share with read only caching.
Ensure that the share will not be modified while in use.
[374786.662199] CIFS VFS: read only mount of RW share

[374793.473091] CIFS: Attempting to mount //localhost/test-ro
[374793.473109] CIFS VFS: mounting share with read only caching.
Ensure that the share will not be modified while in use.
[374793.474266] CIFS VFS: mounted to read only share


-- 
Thanks,

Steve

[-- Attachment #2: 0001-smb3-add-some-more-descriptive-messages-about-share-.patch --]
[-- Type: text/x-patch, Size: 1778 bytes --]

From dd2abf8bbeb317555a0aa7132f663dfe30ae2911 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Thu, 29 Aug 2019 22:33:38 -0500
Subject: [PATCH] smb3: add some more descriptive messages about share when
 mounting cache=ro

Add some additional logging so the user can see if the share they
mounted with cache=ro is considered read only by the server

CIFS: Attempting to mount //localhost/test
CIFS VFS: mounting share with read only caching. Ensure that the share will not be modified while in use.
CIFS VFS: read only mount of RW share

CIFS: Attempting to mount //localhost/test-ro
CIFS VFS: mounting share with read only caching. Ensure that the share will not be modified while in use.
CIFS VFS: mounted to read only share

Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/connect.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 4e622953dd5a..072c01f4e9c1 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -4197,8 +4197,16 @@ static int mount_get_conns(struct smb_vol *vol, struct cifs_sb_info *cifs_sb,
 		tcon->unix_ext = 0; /* server does not support them */
 
 	/* do not care if a following call succeed - informational */
-	if (!tcon->pipe && server->ops->qfs_tcon)
+	if (!tcon->pipe && server->ops->qfs_tcon) {
 		server->ops->qfs_tcon(*xid, tcon);
+		if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RO_CACHE) {
+			if (tcon->fsDevInfo.DeviceCharacteristics &
+			    FILE_READ_ONLY_DEVICE)
+				cifs_dbg(VFS, "mounted to read only share\n");
+			else
+				cifs_dbg(VFS, "read only mount of RW share\n");
+		}
+	}
 
 	cifs_sb->wsize = server->ops->negotiate_wsize(tcon, vol);
 	cifs_sb->rsize = server->ops->negotiate_rsize(tcon, vol);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [SMB3][PATCH] Add more detailed log information on cache=ro mounts
  2019-08-30  3:39 [SMB3][PATCH] Add more detailed log information on cache=ro mounts Steve French
@ 2019-08-30  3:57 ` ronnie sahlberg
  0 siblings, 0 replies; 2+ messages in thread
From: ronnie sahlberg @ 2019-08-30  3:57 UTC (permalink / raw)
  To: Steve French; +Cc: CIFS

reviewed by lsahlber@redhat.com

On Fri, Aug 30, 2019 at 1:40 PM Steve French <smfrench@gmail.com> wrote:
>
> Make it easier to tell if the share we are mounting with cache=ro is
> considered read only by the server.  Obviously there are cases where
> the user could know that no one will be writing to the share but this
> additional information could be helpful.
>
> $ dmesg
> [374786.661113] CIFS: Attempting to mount //localhost/test
> [374786.661130] CIFS VFS: mounting share with read only caching.
> Ensure that the share will not be modified while in use.
> [374786.662199] CIFS VFS: read only mount of RW share
>
> [374793.473091] CIFS: Attempting to mount //localhost/test-ro
> [374793.473109] CIFS VFS: mounting share with read only caching.
> Ensure that the share will not be modified while in use.
> [374793.474266] CIFS VFS: mounted to read only share
>
>
> --
> Thanks,
>
> Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-30  3:39 [SMB3][PATCH] Add more detailed log information on cache=ro mounts Steve French
2019-08-30  3:57 ` ronnie sahlberg

Linux-CIFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-cifs/0 linux-cifs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-cifs linux-cifs/ https://lore.kernel.org/linux-cifs \
		linux-cifs@vger.kernel.org linux-cifs@archiver.kernel.org
	public-inbox-index linux-cifs


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-cifs


AGPL code for this site: git clone https://public-inbox.org/ public-inbox