Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6: [CIFS] Allow reset of file to ATTR_NORMAL when archive bit not set [CIFS] Do not negotiate new POSIX_PATH_OPERATIONS_CAP yet [CIFS] reset mode when client notices that ATTR_READONLY is no longer set
This commit is contained in:
commit
12998096cc
4 changed files with 35 additions and 4 deletions
|
@ -4,6 +4,12 @@ Fix mtime bouncing around from local idea of last write times to remote time.
|
|||
Fix hang (in i_size_read) when simultaneous size update of same remote file
|
||||
on smp system corrupts sequence number. Do not reread unnecessarily partial page
|
||||
(which we are about to overwrite anyway) when writing out file opened rw.
|
||||
When DOS attribute of file on non-Unix server's file changes on the server side
|
||||
from read-only back to read-write, reflect this change in default file mode
|
||||
(we had been leaving a file's mode read-only until the inode were reloaded).
|
||||
Allow setting of attribute back to ATTR_NORMAL (removing readonly dos attribute
|
||||
when archive dos attribute not set and we are changing mode back to writeable
|
||||
on server which does not support the Unix Extensions).
|
||||
|
||||
Version 1.47
|
||||
------------
|
||||
|
|
|
@ -1887,7 +1887,13 @@ typedef struct {
|
|||
calls including posix open
|
||||
and posix unlink */
|
||||
#ifdef CONFIG_CIFS_POSIX
|
||||
#define CIFS_UNIX_CAP_MASK 0x0000003b
|
||||
/* Can not set pathnames cap yet until we send new posix create SMB since
|
||||
otherwise server can treat such handles opened with older ntcreatex
|
||||
(by a new client which knows how to send posix path ops)
|
||||
as non-posix handles (can affect write behavior with byte range locks.
|
||||
We can add back in POSIX_PATH_OPS cap when Posix Create/Mkdir finished */
|
||||
/* #define CIFS_UNIX_CAP_MASK 0x0000003b */
|
||||
#define CIFS_UNIX_CAP_MASK 0x0000001b
|
||||
#else
|
||||
#define CIFS_UNIX_CAP_MASK 0x00000013
|
||||
#endif /* CONFIG_CIFS_POSIX */
|
||||
|
|
|
@ -494,6 +494,12 @@ int cifs_get_inode_info(struct inode **pinode,
|
|||
mode e.g. 555 */
|
||||
if (cifsInfo->cifsAttrs & ATTR_READONLY)
|
||||
inode->i_mode &= ~(S_IWUGO);
|
||||
else if ((inode->i_mode & S_IWUGO) == 0)
|
||||
/* the ATTR_READONLY flag may have been */
|
||||
/* changed on server -- set any w bits */
|
||||
/* allowed by mnt_file_mode */
|
||||
inode->i_mode |= (S_IWUGO &
|
||||
cifs_sb->mnt_file_mode);
|
||||
/* BB add code here -
|
||||
validate if device or weird share or device type? */
|
||||
}
|
||||
|
@ -1190,6 +1196,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
|
|||
struct cifsFileInfo *open_file = NULL;
|
||||
FILE_BASIC_INFO time_buf;
|
||||
int set_time = FALSE;
|
||||
int set_dosattr = FALSE;
|
||||
__u64 mode = 0xFFFFFFFFFFFFFFFFULL;
|
||||
__u64 uid = 0xFFFFFFFFFFFFFFFFULL;
|
||||
__u64 gid = 0xFFFFFFFFFFFFFFFFULL;
|
||||
|
@ -1326,15 +1333,23 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
|
|||
else if (attrs->ia_valid & ATTR_MODE) {
|
||||
rc = 0;
|
||||
if ((mode & S_IWUGO) == 0) /* not writeable */ {
|
||||
if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0)
|
||||
if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) {
|
||||
set_dosattr = TRUE;
|
||||
time_buf.Attributes =
|
||||
cpu_to_le32(cifsInode->cifsAttrs |
|
||||
ATTR_READONLY);
|
||||
}
|
||||
} else if ((mode & S_IWUGO) == S_IWUGO) {
|
||||
if (cifsInode->cifsAttrs & ATTR_READONLY)
|
||||
if (cifsInode->cifsAttrs & ATTR_READONLY) {
|
||||
set_dosattr = TRUE;
|
||||
time_buf.Attributes =
|
||||
cpu_to_le32(cifsInode->cifsAttrs &
|
||||
(~ATTR_READONLY));
|
||||
/* Windows ignores set to zero */
|
||||
if(time_buf.Attributes == 0)
|
||||
time_buf.Attributes |=
|
||||
cpu_to_le32(ATTR_NORMAL);
|
||||
}
|
||||
}
|
||||
/* BB to be implemented -
|
||||
via Windows security descriptors or streams */
|
||||
|
@ -1372,7 +1387,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
|
|||
} else
|
||||
time_buf.ChangeTime = 0;
|
||||
|
||||
if (set_time || time_buf.Attributes) {
|
||||
if (set_time || set_dosattr) {
|
||||
time_buf.CreationTime = 0; /* do not change */
|
||||
/* In the future we should experiment - try setting timestamps
|
||||
via Handle (SetFileInfo) instead of by path */
|
||||
|
|
|
@ -219,6 +219,10 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
|
|||
tmp_inode->i_mode |= S_IFREG;
|
||||
if (attr & ATTR_READONLY)
|
||||
tmp_inode->i_mode &= ~(S_IWUGO);
|
||||
else if ((tmp_inode->i_mode & S_IWUGO) == 0)
|
||||
/* the ATTR_READONLY flag may have been changed on */
|
||||
/* server -- set any w bits allowed by mnt_file_mode */
|
||||
tmp_inode->i_mode |= (S_IWUGO & cifs_sb->mnt_file_mode);
|
||||
} /* could add code here - to validate if device or weird share type? */
|
||||
|
||||
/* can not fill in nlink here as in qpathinfo version and Unx search */
|
||||
|
|
Loading…
Reference in a new issue