aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-02-01 13:52:45 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-02-01 13:52:45 -0500
commit0f44bc36ba1cddbd34371110c4ef8f0800c8d465 (patch)
treece5f664e91af8bc0988830acdacbba5080d9c5f3
parentefc518eb318c4d776933c23e7b82c2e5402b62de (diff)
parenta9a315d41407cd1079eb815f4adae897cc08b0d2 (diff)
Merge branch 'for-linus' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs fixes from Steve French: "A set of cifs fixes (mostly for symlinks, and SMB2 xattrs) and cleanups" * 'for-linus' of git://git.samba.org/sfrench/cifs-2.6: cifs: Fix check for regular file in couldbe_mf_symlink() [CIFS] Fix SMB2 mounts so they don't try to set or get xattrs via cifs CIFS: Cleanup cifs open codepath CIFS: Remove extra indentation in cifs_sfu_type CIFS: Cleanup cifs_mknod CIFS: Cleanup CIFSSMBOpen cifs: Add support for follow_link on dfs shares under posix extensions cifs: move unix extension call to cifs_query_symlink() cifs: Re-order M-F Symlink code cifs: Add create MFSymlinks to protocol ops struct cifs: use protocol specific call for query_mf_symlink() cifs: Rename MF symlink function names cifs: Rename and cleanup open_query_close_cifs_symlink() cifs: Fix memory leak in cifs_hardlink()
-rw-r--r--fs/cifs/cifsacl.c40
-rw-r--r--fs/cifs/cifsglob.h14
-rw-r--r--fs/cifs/cifsproto.h22
-rw-r--r--fs/cifs/cifssmb.c158
-rw-r--r--fs/cifs/dir.c59
-rw-r--r--fs/cifs/file.c2
-rw-r--r--fs/cifs/inode.c178
-rw-r--r--fs/cifs/link.c323
-rw-r--r--fs/cifs/readdir.c2
-rw-r--r--fs/cifs/smb1ops.c126
-rw-r--r--fs/cifs/xattr.c49
11 files changed, 553 insertions, 420 deletions
</
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index 51f5e0ee7237..8f9b4f710d4a 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -895,9 +895,10 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
895 int oplock = 0; 895 int oplock = 0;
896 unsigned int xid; 896 unsigned int xid;
897 int rc, create_options = 0; 897 int rc, create_options = 0;
898 __u16 fid;
899 struct cifs_tcon *tcon; 898 struct cifs_tcon *tcon;
900 struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); 899 struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
900 struct cifs_fid fid;
901 struct cifs_open_parms oparms;
901 902
902 if (IS_ERR(tlink)) 903 if (IS_ERR(tlink))
903 return ERR_CAST(tlink); 904 return ERR_CAST(tlink);
@@ -908,12 +909,19 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
908 if (backup_cred(cifs_sb)) 909 if (backup_cred(cifs_sb))
909 create_options |= CREATE_OPEN_BACKUP_INTENT; 910 create_options |= CREATE_OPEN_BACKUP_INTENT;
910 911
911 rc = CIFSSMBOpen(xid, tcon, path, FILE_OPEN, READ_CONTROL, 912 oparms.tcon = tcon;
912 create_options, &fid, &oplock, NULL, cifs_sb->local_nls, 913 oparms.cifs_sb = cifs_sb;
913 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 914 oparms.desired_access = READ_CONTROL;
915 oparms.create_options = create_options;
916 oparms.disposition = FILE_OPEN;
917 oparms.path = path;
918 oparms.fid = &fid;
919 oparms.reconnect = false;
920
921 rc = CIFS_open(xid, &oparms, &oplock, NULL);
914 if (!rc) { 922 if (!rc) {
915 rc = CIFSSMBGetCIFSACL(xid, tcon, fid, &pntsd, pacllen); 923 rc = CIFSSMBGetCIFSACL(xid, tcon, fid.netfid, &pntsd, pacllen);
916 CIFSSMBClose(xid, tcon, fid); 924 CIFSSMBClose(xid, tcon, fid.netfid);
917 } 925 }
918 926
919 cifs_put_tlink(tlink); 927 cifs_put_tlink(tlink);
@@ -950,10 +958,11 @@ int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
950 int oplock = 0; 958 int oplock = 0;
951 unsigned int xid; 959 unsigned int xid;
952 int rc, access_flags, create_options = 0; 960 int rc, access_flags, create_options = 0;
953 __u16 fid;
954 struct cifs_tcon *tcon; 961 struct cifs_tcon *tcon;
955 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 962 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
956 struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); 963 struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
964 struct cifs_fid fid;
965 struct cifs_open_parms oparms;
957 966
958 if (IS_ERR(tlink)) 967 if (IS_ERR(tlink))
959 return PTR_ERR(tlink); 968 return PTR_ERR(tlink);
@@ -969,18 +978,25 @@ int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
969 else 978 else
970 access_flags = WRITE_DAC; 979 access_flags = WRITE_DAC;
971 980
972 rc = CIFSSMBOpen(xid, tcon, path, FILE_OPEN, access_flags, 981 oparms.tcon = tcon;
973 create_options, &fid, &oplock, NULL, cifs_sb->local_nls, 982 oparms.cifs_sb = cifs_sb;
974 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 983 oparms.desired_access = access_flags;
984 oparms.create_options = create_options;
985 oparms.disposition = FILE_OPEN;
986 oparms.path = path;
987 oparms.fid = &fid;
988 oparms.reconnect = false;
989
990 rc = CIFS_open(xid, &oparms, &oplock, NULL);
975 if (rc) { 991 if (rc) {
976 cifs_dbg(VFS, "Unable to open file to set ACL\n"); 992 cifs_dbg(VFS, "Unable to open file to set ACL\n");
977 goto out; 993 goto out;
978 } 994 }
979 995
980 rc = CIFSSMBSetCIFSACL(xid, tcon, fid, pnntsd, acllen, aclflag); 996 rc = CIFSSMBSetCIFSACL(xid, tcon, fid.netfid, pnntsd, acllen, aclflag);
981 cifs_dbg(NOISY, "SetCIFSACL rc = %d\n", rc); 997 cifs_dbg(NOISY, "SetCIFSACL rc = %d\n", rc);
982 998
983 CIFSSMBClose(xid, tcon, fid); 999 CIFSSMBClose(xid, tcon, fid.netfid);
984out: 1000out:
985 free_xid(xid); 1001 free_xid(xid);
986 cifs_put_tlink(tlink); 1002 cifs_put_tlink(tlink);
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index f918a998a087..a245d1809ed8 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -370,8 +370,12 @@ struct smb_version_operations {
370 void (*new_lease_key)(struct cifs_fid *); 370 void (*new_lease_key)(struct cifs_fid *);
371 int (*generate_signingkey)(struct cifs_ses *); 371 int (*generate_signingkey)(struct cifs_ses *);
372 int (*calc_signature)(struct smb_rqst *, struct TCP_Server_Info *); 372 int (*calc_signature)(struct smb_rqst *, struct TCP_Server_Info *);
373 int (*query_mf_symlink)(const unsigned char *, char *, unsigned int *, 373 int (*query_mf_symlink)(unsigned int, struct cifs_tcon *,
374 struct cifs_sb_info *, unsigned int); 374 struct cifs_sb_info *, const unsigned char *,
375 char *, unsigned int *);
376 int (*create_mf_symlink)(unsigned int, struct cifs_tcon *,
377 struct cifs_sb_info *, const unsigned char *,
378 char *, unsigned int *);
375 /* if we can do cache read operations */ 379 /* if we can do cache read operations */
376 bool (*is_read_op)(__u32); 380 bool (*is_read_op)(__u32);
377 /* set oplock level for the inode */ 381 /* set oplock level for the inode */
@@ -385,6 +389,12 @@ struct smb_version_operations {
385 struct cifsFileInfo *target_file, u64 src_off, u64 len, 389 struct cifsFileInfo *target_file, u64 src_off, u64 len,
386 u64 dest_off); 390 u64 dest_off);
387 int (*validate_negotiate)(const unsigned int, struct cifs_tcon *); 391 int (*validate_negotiate)(const unsigned int, struct cifs_tcon *);
392 ssize_t (*query_all_EAs)(const unsigned int, struct cifs_tcon *,
393 const unsigned char *, const unsigned char *, char *,
394 size_t, const struct nls_table *, int);
395 int (*set_EA)(const unsigned int, struct cifs_tcon *, const char *,
396 const char *, const void *, const __u16,
397 const struct nls_table *, int);
388}; 398};
389 399
390struct smb_version_values { 400struct smb_version_values {
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 2c29db6a247e..79e6e9a93a8c 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -362,11 +362,8 @@ extern int CIFSSMBQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon,
362 const struct nls_table *nls_codepage); 362 const struct nls_table *nls_codepage);
363extern int CIFSSMB_set_compression(const unsigned int xid, 363extern int CIFSSMB_set_compression(const unsigned int xid,
364 struct cifs_tcon *tcon, __u16 fid); 364 struct cifs_tcon *tcon, __u16 fid);
365extern int CIFSSMBOpen(const unsigned int xid, struct cifs_tcon *tcon, 365extern int CIFS_open(const unsigned int xid, struct cifs_open_parms *oparms,
366 const char *fileName, const int disposition, 366 int *oplock, FILE_ALL_INFO *buf);
367 const int access_flags, const int omode,
368 __u16 *netfid, int *pOplock, FILE_ALL_INFO *,
369 const struct nls_table *nls_codepage, int remap);
370extern int SMBLegacyOpen(const unsigned int xid, struct cifs_tcon *tcon, 367extern int SMBLegacyOpen(const unsigned int xid, struct cifs_tcon *tcon,
371 const char *fileName, const int disposition, 368 const char *fileName, const int disposition,
372 const int access_flags, const int omode, 369 const int access_flags, const int omode,
@@ -476,8 +473,8 @@ extern int CIFSSMBSetPosixACL(const unsigned int xid, struct cifs_tcon *tcon,
476extern int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon, 473extern int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon,
477 const int netfid, __u64 *pExtAttrBits, __u64 *pMask); 474 const int netfid, __u64 *pExtAttrBits, __u64 *pMask);
478extern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb); 475extern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb);
479extern bool CIFSCouldBeMFSymlink(const struct cifs_fattr *fattr); 476extern bool couldbe_mf_symlink(const struct cifs_fattr *fattr);
480extern int CIFSCheckMFSymlink(unsigned int xid, struct cifs_tcon *tcon, 477extern int check_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
481 struct cifs_sb_info *cifs_sb, 478 struct cifs_sb_info *cifs_sb,
482 struct cifs_fattr *fattr, 479 struct cifs_fattr *fattr,
483 const unsigned char *path); 480 const unsigned char *path);
@@ -496,7 +493,12 @@ void cifs_writev_complete(struct work_struct *work);
496struct cifs_writedata *cifs_writedata_alloc(unsigned int nr_pages, 493struct cifs_writedata *cifs_writedata_alloc(unsigned int nr_pages,
497 work_func_t complete); 494 work_func_t complete);
498void cifs_writedata_release(struct kref *refcount); 495void cifs_writedata_release(struct kref *refcount);
499int open_query_close_cifs_symlink(const unsigned char *path, char *pbuf, 496int cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
500 unsigned int *pbytes_read, struct cifs_sb_info *cifs_sb, 497 struct cifs_sb_info *cifs_sb,
501 unsigned int xid); 498 const unsigned char *path, char *pbuf,
499 unsigned int *pbytes_read);