Commit 7006433c authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'v7.0-rc4-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fixes from Steve French:

 - Fix reporting of i_blocks

 - Fix Kerberos mounts with different usernames to same server

 - Trivial comment cleanup

* tag 'v7.0-rc4-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
  smb: client: fix generic/694 due to wrong ->i_blocks
  cifs: smb1: fix comment typo
  smb: client: fix krb5 mount with username option
parents f2689647 23b5df09
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2386,4 +2386,10 @@ static inline int cifs_open_create_options(unsigned int oflags, int opts)
	return opts;
}

/*
 * The number of blocks is not related to (i_size / i_blksize), but instead
 * 512 byte (2**9) size is required for calculating num blocks.
 */
#define CIFS_INO_BLOCKS(size) DIV_ROUND_UP_ULL((u64)(size), 512)

#endif	/* _CIFS_GLOB_H */
+4 −0
Original line number Diff line number Diff line
@@ -1955,6 +1955,10 @@ static int match_session(struct cifs_ses *ses,
	case Kerberos:
		if (!uid_eq(ctx->cred_uid, ses->cred_uid))
			return 0;
		if (strncmp(ses->user_name ?: "",
			    ctx->username ?: "",
			    CIFS_MAX_USERNAME_LEN))
			return 0;
		break;
	case NTLMv2:
	case RawNTLMSSP:
+0 −1
Original line number Diff line number Diff line
@@ -993,7 +993,6 @@ static int cifs_do_truncate(const unsigned int xid, struct dentry *dentry)
		if (!rc) {
			netfs_resize_file(&cinode->netfs, 0, true);
			cifs_setsize(inode, 0);
			inode->i_blocks = 0;
		}
	}
	if (cfile)
+6 −15
Original line number Diff line number Diff line
@@ -219,13 +219,7 @@ cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr,
	 */
	if (is_size_safe_to_change(cifs_i, fattr->cf_eof, from_readdir)) {
		i_size_write(inode, fattr->cf_eof);

		/*
		 * i_blocks is not related to (i_size / i_blksize),
		 * but instead 512 byte (2**9) size is required for
		 * calculating num blocks.
		 */
		inode->i_blocks = (512 - 1 + fattr->cf_bytes) >> 9;
		inode->i_blocks = CIFS_INO_BLOCKS(fattr->cf_bytes);
	}

	if (S_ISLNK(fattr->cf_mode) && fattr->cf_symlink_target) {
@@ -3015,6 +3009,11 @@ void cifs_setsize(struct inode *inode, loff_t offset)
{
	spin_lock(&inode->i_lock);
	i_size_write(inode, offset);
	/*
	 * Until we can query the server for actual allocation size,
	 * this is best estimate we have for blocks allocated for a file.
	 */
	inode->i_blocks = CIFS_INO_BLOCKS(offset);
	spin_unlock(&inode->i_lock);
	inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
	truncate_pagecache(inode, offset);
@@ -3087,14 +3086,6 @@ int cifs_file_set_size(const unsigned int xid, struct dentry *dentry,
	if (rc == 0) {
		netfs_resize_file(&cifsInode->netfs, size, true);
		cifs_setsize(inode, size);
		/*
		 * i_blocks is not related to (i_size / i_blksize), but instead
		 * 512 byte (2**9) size is required for calculating num blocks.
		 * Until we can query the server for actual allocation size,
		 * this is best estimate we have for blocks allocated for a file
		 * Number of blocks must be rounded up so size 1 is not 0 blocks
		 */
		inode->i_blocks = (512 - 1 + size) >> 9;
	}

	return rc;
+1 −1
Original line number Diff line number Diff line
@@ -460,7 +460,7 @@ check_smb_hdr(struct smb_hdr *smb)
		return 0;

	/*
	 * Windows NT server returns error resposne (e.g. STATUS_DELETE_PENDING
	 * Windows NT server returns error response (e.g. STATUS_DELETE_PENDING
	 * or STATUS_OBJECT_NAME_NOT_FOUND or ERRDOS/ERRbadfile or any other)
	 * for some TRANS2 requests without the RESPONSE flag set in header.
	 */
Loading