All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Klos <honza.klos-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Steve French <sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	trivial-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	Jan Klos <honza.klos-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: cifs: Fix inability to write files >2GB to SMB2/3 shares (FIXED)
Date: Sun, 06 Oct 2013 20:37:56 +0200	[thread overview]
Message-ID: <5251AE04.4030206@gmail.com> (raw)

When connecting to SMB2/3 shares, maximum file size is set to non-LFS maximum in superblock. This is due to cap_large_files bit being different for 
SMB1 and SMB2/3 (where it is just an internal flag that is not negotiated and the SMB1 one corresponds to multichannel capability) while capabilities 
are checked always for the SMB1 bit in cifs_read_super().

The patch fixes this by checking for the correct bit according to the protocol version.

Sorry for the repost, GMail messed up my previous mail (and I even confirmed it on the mailing list!), sorry!


Signed-off-by: Jan Klos <honza.klos-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

---

diff -uprN a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
--- a/fs/cifs/cifsfs.c	2013-10-05 16:18:07.000000000 +0200
+++ b/fs/cifs/cifsfs.c	2013-10-06 16:18:13.488378000 +0200
@@ -120,14 +120,16 @@ cifs_read_super(struct super_block *sb)
  {
  	struct inode *inode;
  	struct cifs_sb_info *cifs_sb;
+	struct cifs_tcon *tcon;
  	int rc = 0;

  	cifs_sb = CIFS_SB(sb);
+	tcon = cifs_sb_master_tcon(cifs_sb);

  	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIXACL)
  		sb->s_flags |= MS_POSIXACL;

-	if (cifs_sb_master_tcon(cifs_sb)->ses->capabilities & CAP_LARGE_FILES)
+	if (tcon->ses->capabilities & tcon->ses->server->vals->cap_large_files)
  		sb->s_maxbytes = MAX_LFS_FILESIZE;
  	else
  		sb->s_maxbytes = MAX_NON_LFS;
@@ -147,7 +149,7 @@ cifs_read_super(struct super_block *sb)
  		goto out_no_root;
  	}

-	if (cifs_sb_master_tcon(cifs_sb)->nocase)
+	if (tcon->nocase)
  		sb->s_d_op = &cifs_ci_dentry_ops;
  	else
  		sb->s_d_op = &cifs_dentry_ops;

WARNING: multiple messages have this Message-ID (diff)
From: Jan Klos <honza.klos@gmail.com>
To: Steve French <sfrench@samba.org>
Cc: linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
	linux-kernel@vger.kernel.org, trivial@kernel.org,
	Jan Klos <honza.klos@gmail.com>
Subject: cifs: Fix inability to write files >2GB to SMB2/3 shares (FIXED)
Date: Sun, 06 Oct 2013 20:37:56 +0200	[thread overview]
Message-ID: <5251AE04.4030206@gmail.com> (raw)

When connecting to SMB2/3 shares, maximum file size is set to non-LFS maximum in superblock. This is due to cap_large_files bit being different for 
SMB1 and SMB2/3 (where it is just an internal flag that is not negotiated and the SMB1 one corresponds to multichannel capability) while capabilities 
are checked always for the SMB1 bit in cifs_read_super().

The patch fixes this by checking for the correct bit according to the protocol version.

Sorry for the repost, GMail messed up my previous mail (and I even confirmed it on the mailing list!), sorry!


Signed-off-by: Jan Klos <honza.klos@gmail.com>

---

diff -uprN a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
--- a/fs/cifs/cifsfs.c	2013-10-05 16:18:07.000000000 +0200
+++ b/fs/cifs/cifsfs.c	2013-10-06 16:18:13.488378000 +0200
@@ -120,14 +120,16 @@ cifs_read_super(struct super_block *sb)
  {
  	struct inode *inode;
  	struct cifs_sb_info *cifs_sb;
+	struct cifs_tcon *tcon;
  	int rc = 0;

  	cifs_sb = CIFS_SB(sb);
+	tcon = cifs_sb_master_tcon(cifs_sb);

  	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIXACL)
  		sb->s_flags |= MS_POSIXACL;

-	if (cifs_sb_master_tcon(cifs_sb)->ses->capabilities & CAP_LARGE_FILES)
+	if (tcon->ses->capabilities & tcon->ses->server->vals->cap_large_files)
  		sb->s_maxbytes = MAX_LFS_FILESIZE;
  	else
  		sb->s_maxbytes = MAX_NON_LFS;
@@ -147,7 +149,7 @@ cifs_read_super(struct super_block *sb)
  		goto out_no_root;
  	}

-	if (cifs_sb_master_tcon(cifs_sb)->nocase)
+	if (tcon->nocase)
  		sb->s_d_op = &cifs_ci_dentry_ops;
  	else
  		sb->s_d_op = &cifs_dentry_ops;

             reply	other threads:[~2013-10-06 18:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-06 18:37 Jan Klos [this message]
2013-10-06 18:37 ` cifs: Fix inability to write files >2GB to SMB2/3 shares (FIXED) Jan Klos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5251AE04.4030206@gmail.com \
    --to=honza.klos-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org \
    --cc=sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org \
    --cc=trivial-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.