Merge branch 'for-cifs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 17 May 2016 21:35:45 +0000 (14:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 17 May 2016 21:35:45 +0000 (14:35 -0700)
Pull cifs xattr updates from Al Viro:
 "This is the remaining parts of the xattr work - the cifs bits"

* 'for-cifs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  cifs: Switch to generic xattr handlers
  cifs: Fix removexattr for os2.* xattrs
  cifs: Check for equality with ACL_TYPE_ACCESS and ACL_TYPE_DEFAULT
  cifs: Fix xattr name checks

1  2 
fs/cifs/cifsfs.c
fs/cifs/cifssmb.c

diff --combined fs/cifs/cifsfs.c
index aadb59388e909a392a922dabb62c249179b18ffe,43cc522b11e4baa796528b44c0230a61f4d5d3ad..08fa36e5b2bca2ffddb8c612dd41c617a8edfab1
@@@ -37,6 -37,7 +37,7 @@@
  #include <linux/freezer.h>
  #include <linux/namei.h>
  #include <linux/random.h>
+ #include <linux/xattr.h>
  #include <net/ipv6.h>
  #include "cifsfs.h"
  #include "cifspdu.h"
@@@ -135,6 -136,7 +136,7 @@@ cifs_read_super(struct super_block *sb
  
        sb->s_magic = CIFS_MAGIC_NUMBER;
        sb->s_op = &cifs_super_ops;
+       sb->s_xattr = cifs_xattr_handlers;
        sb->s_bdi = &cifs_sb->bdi;
        sb->s_blocksize = CIFS_MAX_MSGSIZE;
        sb->s_blocksize_bits = 14;      /* default 2**14 = CIFS_MAX_MSGSIZE */
@@@ -892,12 -894,10 +894,10 @@@ const struct inode_operations cifs_dir_
        .setattr = cifs_setattr,
        .symlink = cifs_symlink,
        .mknod   = cifs_mknod,
- #ifdef CONFIG_CIFS_XATTR
-       .setxattr = cifs_setxattr,
-       .getxattr = cifs_getxattr,
+       .setxattr = generic_setxattr,
+       .getxattr = generic_getxattr,
        .listxattr = cifs_listxattr,
-       .removexattr = cifs_removexattr,
- #endif
+       .removexattr = generic_removexattr,
  };
  
  const struct inode_operations cifs_file_inode_ops = {
        .setattr = cifs_setattr,
        .getattr = cifs_getattr, /* do we need this anymore? */
        .permission = cifs_permission,
- #ifdef CONFIG_CIFS_XATTR
-       .setxattr = cifs_setxattr,
-       .getxattr = cifs_getxattr,
+       .setxattr = generic_setxattr,
+       .getxattr = generic_getxattr,
        .listxattr = cifs_listxattr,
-       .removexattr = cifs_removexattr,
- #endif
+       .removexattr = generic_removexattr,
  };
  
  const struct inode_operations cifs_symlink_inode_ops = {
        /* BB add the following two eventually */
        /* revalidate: cifs_revalidate,
           setattr:    cifs_notify_change, *//* BB do we need notify change */
- #ifdef CONFIG_CIFS_XATTR
-       .setxattr = cifs_setxattr,
-       .getxattr = cifs_getxattr,
+       .setxattr = generic_setxattr,
+       .getxattr = generic_getxattr,
        .listxattr = cifs_listxattr,
-       .removexattr = cifs_removexattr,
- #endif
+       .removexattr = generic_removexattr,
  };
  
  static int cifs_clone_file_range(struct file *src_file, loff_t off,
        cifs_dbg(FYI, "about to flush pages\n");
        /* should we flush first and last page first */
        truncate_inode_pages_range(&target_inode->i_data, destoff,
 -                                 PAGE_CACHE_ALIGN(destoff + len)-1);
 +                                 PAGE_ALIGN(destoff + len)-1);
  
        if (target_tcon->ses->server->ops->duplicate_extents)
                rc = target_tcon->ses->server->ops->duplicate_extents(xid,
@@@ -1083,7 -1079,7 +1079,7 @@@ const struct file_operations cifs_file_
  };
  
  const struct file_operations cifs_dir_ops = {
 -      .iterate = cifs_readdir,
 +      .iterate_shared = cifs_readdir,
        .release = cifs_closedir,
        .read    = generic_read_dir,
        .unlocked_ioctl  = cifs_ioctl,
diff --combined fs/cifs/cifssmb.c
index a894bf809ff71ffd363407e5d380d619fd364fa9,f24a89c5a518d6187cd9effdeb807df15dbdfa37..145c03e75ee49c13ce8512e950cff076837c0c7f
@@@ -1929,17 -1929,17 +1929,17 @@@ cifs_writev_requeue(struct cifs_writeda
  
                wsize = server->ops->wp_retry_size(inode);
                if (wsize < rest_len) {
 -                      nr_pages = wsize / PAGE_CACHE_SIZE;
 +                      nr_pages = wsize / PAGE_SIZE;
                        if (!nr_pages) {
                                rc = -ENOTSUPP;
                                break;
                        }
 -                      cur_len = nr_pages * PAGE_CACHE_SIZE;
 -                      tailsz = PAGE_CACHE_SIZE;
 +                      cur_len = nr_pages * PAGE_SIZE;
 +                      tailsz = PAGE_SIZE;
                } else {
 -                      nr_pages = DIV_ROUND_UP(rest_len, PAGE_CACHE_SIZE);
 +                      nr_pages = DIV_ROUND_UP(rest_len, PAGE_SIZE);
                        cur_len = rest_len;
 -                      tailsz = rest_len - (nr_pages - 1) * PAGE_CACHE_SIZE;
 +                      tailsz = rest_len - (nr_pages - 1) * PAGE_SIZE;
                }
  
                wdata2 = cifs_writedata_alloc(nr_pages, cifs_writev_complete);
                wdata2->sync_mode = wdata->sync_mode;
                wdata2->nr_pages = nr_pages;
                wdata2->offset = page_offset(wdata2->pages[0]);
 -              wdata2->pagesz = PAGE_CACHE_SIZE;
 +              wdata2->pagesz = PAGE_SIZE;
                wdata2->tailsz = tailsz;
                wdata2->bytes = cur_len;
  
                        if (rc != 0 && rc != -EAGAIN) {
                                SetPageError(wdata2->pages[j]);
                                end_page_writeback(wdata2->pages[j]);
 -                              page_cache_release(wdata2->pages[j]);
 +                              put_page(wdata2->pages[j]);
                        }
                }
  
@@@ -2018,7 -2018,7 +2018,7 @@@ cifs_writev_complete(struct work_struc
                else if (wdata->result < 0)
                        SetPageError(page);
                end_page_writeback(page);
 -              page_cache_release(page);
 +              put_page(page);
        }
        if (wdata->result != -EAGAIN)
                mapping_set_error(inode->i_mapping, wdata->result);
@@@ -3366,7 -3366,7 +3366,7 @@@ static int cifs_copy_posix_acl(char *tr
        if (le16_to_cpu(cifs_acl->version) != CIFS_ACL_VERSION)
                return -EOPNOTSUPP;
  
-       if (acl_type & ACL_TYPE_ACCESS) {
+       if (acl_type == ACL_TYPE_ACCESS) {
                count = le16_to_cpu(cifs_acl->access_entry_count);
                pACE = &cifs_acl->ace_array[0];
                size = sizeof(struct cifs_posix_acl);
                                 size_of_data_area, size);
                        return -EINVAL;
                }
-       } else if (acl_type & ACL_TYPE_DEFAULT) {
+       } else if (acl_type == ACL_TYPE_DEFAULT) {
                count = le16_to_cpu(cifs_acl->access_entry_count);
                size = sizeof(struct cifs_posix_acl);
                size += sizeof(struct cifs_posix_ace) * count;