Commit 24ebb52c authored by Pavel Shilovsky's avatar Pavel Shilovsky

Update 3.4 sources from stable (v3.4.102)

parent ba397eb8
...@@ -290,7 +290,8 @@ int ...@@ -290,7 +290,8 @@ int
cifsConvertToUTF16(__le16 *target, const char *source, int srclen, cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
const struct nls_table *cp, int mapChars) const struct nls_table *cp, int mapChars)
{ {
int i, j, charlen; int i, charlen;
int j = 0;
char src_char; char src_char;
__le16 dst_char; __le16 dst_char;
wchar_t tmp; wchar_t tmp;
...@@ -298,12 +299,11 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen, ...@@ -298,12 +299,11 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
if (!mapChars) if (!mapChars)
return cifs_strtoUTF16(target, source, PATH_MAX, cp); return cifs_strtoUTF16(target, source, PATH_MAX, cp);
for (i = 0, j = 0; i < srclen; j++) { for (i = 0; i < srclen; j++) {
src_char = source[i]; src_char = source[i];
charlen = 1; charlen = 1;
switch (src_char) { switch (src_char) {
case 0: case 0:
put_unaligned(0, &target[j]);
goto ctoUTF16_out; goto ctoUTF16_out;
case ':': case ':':
dst_char = cpu_to_le16(UNI_COLON); dst_char = cpu_to_le16(UNI_COLON);
...@@ -350,6 +350,7 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen, ...@@ -350,6 +350,7 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
} }
ctoUTF16_out: ctoUTF16_out:
put_unaligned(0, &target[j]); /* Null terminate target unicode string */
return j; return j;
} }
...@@ -87,6 +87,30 @@ extern mempool_t *cifs_mid_poolp; ...@@ -87,6 +87,30 @@ extern mempool_t *cifs_mid_poolp;
struct workqueue_struct *cifsiod_wq; struct workqueue_struct *cifsiod_wq;
/*
* Bumps refcount for cifs super block.
* Note that it should be only called if a referece to VFS super block is
* already held, e.g. in open-type syscalls context. Otherwise it can race with
* atomic_dec_and_test in deactivate_locked_super.
*/
void
cifs_sb_active(struct super_block *sb)
{
struct cifs_sb_info *server = CIFS_SB(sb);
if (atomic_inc_return(&server->active) == 1)
atomic_inc(&sb->s_active);
}
void
cifs_sb_deactive(struct super_block *sb)
{
struct cifs_sb_info *server = CIFS_SB(sb);
if (atomic_dec_and_test(&server->active))
deactivate_super(sb);
}
static int static int
cifs_read_super(struct super_block *sb) cifs_read_super(struct super_block *sb)
{ {
......
...@@ -41,6 +41,10 @@ extern struct file_system_type cifs_fs_type; ...@@ -41,6 +41,10 @@ extern struct file_system_type cifs_fs_type;
extern const struct address_space_operations cifs_addr_ops; extern const struct address_space_operations cifs_addr_ops;
extern const struct address_space_operations cifs_addr_ops_smallbuf; extern const struct address_space_operations cifs_addr_ops_smallbuf;
/* Functions related to super block operations */
extern void cifs_sb_active(struct super_block *sb);
extern void cifs_sb_deactive(struct super_block *sb);
/* Functions related to inodes */ /* Functions related to inodes */
extern const struct inode_operations cifs_dir_inode_ops; extern const struct inode_operations cifs_dir_inode_ops;
extern struct inode *cifs_root_iget(struct super_block *); extern struct inode *cifs_root_iget(struct super_block *);
......
...@@ -3461,11 +3461,13 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL, ...@@ -3461,11 +3461,13 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,
return 0; return 0;
} }
cifs_acl->version = cpu_to_le16(1); cifs_acl->version = cpu_to_le16(1);
if (acl_type == ACL_TYPE_ACCESS) if (acl_type == ACL_TYPE_ACCESS) {
cifs_acl->access_entry_count = cpu_to_le16(count); cifs_acl->access_entry_count = cpu_to_le16(count);
else if (acl_type == ACL_TYPE_DEFAULT) cifs_acl->default_entry_count = __constant_cpu_to_le16(0xFFFF);
} else if (acl_type == ACL_TYPE_DEFAULT) {
cifs_acl->default_entry_count = cpu_to_le16(count); cifs_acl->default_entry_count = cpu_to_le16(count);
else { cifs_acl->access_entry_count = __constant_cpu_to_le16(0xFFFF);
} else {
cFYI(1, "unknown ACL type %d", acl_type); cFYI(1, "unknown ACL type %d", acl_type);
return 0; return 0;
} }
......
...@@ -267,6 +267,8 @@ cifs_new_fileinfo(__u16 fileHandle, struct file *file, ...@@ -267,6 +267,8 @@ cifs_new_fileinfo(__u16 fileHandle, struct file *file,
mutex_init(&pCifsFile->fh_mutex); mutex_init(&pCifsFile->fh_mutex);
INIT_WORK(&pCifsFile->oplock_break, cifs_oplock_break); INIT_WORK(&pCifsFile->oplock_break, cifs_oplock_break);
cifs_sb_active(inode->i_sb);
spin_lock(&cifs_file_list_lock); spin_lock(&cifs_file_list_lock);
list_add(&pCifsFile->tlist, &(tlink_tcon(tlink)->openFileList)); list_add(&pCifsFile->tlist, &(tlink_tcon(tlink)->openFileList));
/* if readable file instance put first in list*/ /* if readable file instance put first in list*/
...@@ -295,7 +297,8 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) ...@@ -295,7 +297,8 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
struct inode *inode = cifs_file->dentry->d_inode; struct inode *inode = cifs_file->dentry->d_inode;
struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink); struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink);
struct cifsInodeInfo *cifsi = CIFS_I(inode); struct cifsInodeInfo *cifsi = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct super_block *sb = inode->i_sb;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct cifsLockInfo *li, *tmp; struct cifsLockInfo *li, *tmp;
spin_lock(&cifs_file_list_lock); spin_lock(&cifs_file_list_lock);
...@@ -347,6 +350,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) ...@@ -347,6 +350,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
cifs_put_tlink(cifs_file->tlink); cifs_put_tlink(cifs_file->tlink);
dput(cifs_file->dentry); dput(cifs_file->dentry);
cifs_sb_deactive(sb);
kfree(cifs_file); kfree(cifs_file);
} }
...@@ -888,7 +892,7 @@ cifs_push_mandatory_locks(struct cifsFileInfo *cfile) ...@@ -888,7 +892,7 @@ cifs_push_mandatory_locks(struct cifsFileInfo *cfile)
if (!buf) { if (!buf) {
mutex_unlock(&cinode->lock_mutex); mutex_unlock(&cinode->lock_mutex);
FreeXid(xid); FreeXid(xid);
return rc; return -ENOMEM;
} }
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment