diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-14 00:15:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-14 00:15:42 -0500 |
commit | 9468482bd4c3b89abe04a770848d5eaa1ea830b0 (patch) | |
tree | 7bac4349702c6414e78d83e6d6febd633177f52a /fs | |
parent | 551a10c7fc14640d484ee3dda699758041d8123f (diff) | |
parent | 8af18971584d1e05770560206cfdfd1d6ba8a17f (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/sfrench/cifs-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
[CIFS] on reconnect to Samba - reset the unix capabilities
[CIFS] Allow update of EOF on remote extend of file
[CIFS] POSIX CIFS Extensions (continued) - POSIX Open
[CIFS] Additional POSIX CIFS Extensions infolevels
Diffstat (limited to 'fs')
-rw-r--r-- | fs/Kconfig | 29 | ||||
-rw-r--r-- | fs/cifs/CHANGES | 9 | ||||
-rw-r--r-- | fs/cifs/TODO | 8 | ||||
-rw-r--r-- | fs/cifs/cifsfs.h | 2 | ||||
-rw-r--r-- | fs/cifs/cifspdu.h | 84 | ||||
-rw-r--r-- | fs/cifs/cifsproto.h | 5 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 16 | ||||
-rw-r--r-- | fs/cifs/connect.c | 130 | ||||
-rw-r--r-- | fs/cifs/file.c | 5 | ||||
-rw-r--r-- | fs/cifs/inode.c | 6 | ||||
-rw-r--r-- | fs/cifs/readdir.c | 6 |
11 files changed, 203 insertions, 97 deletions
diff --git a/fs/Kconfig b/fs/Kconfig index 488521ed9e9b..a722b5a3f752 100644 --- a/fs/Kconfig +++ b/fs/Kconfig | |||
@@ -1864,20 +1864,14 @@ config CIFS | |||
1864 | file servers such as Windows 2000 (including Windows 2003, NT 4 | 1864 | file servers such as Windows 2000 (including Windows 2003, NT 4 |
1865 | and Windows XP) as well by Samba (which provides excellent CIFS | 1865 | and Windows XP) as well by Samba (which provides excellent CIFS |
1866 | server support for Linux and many other operating systems). Limited | 1866 | server support for Linux and many other operating systems). Limited |
1867 | support for Windows ME and similar servers is provided as well. | 1867 | support for OS/2 and Windows ME and similar servers is provided as well. |
1868 | You must use the smbfs client filesystem to access older SMB servers | ||
1869 | such as OS/2 and DOS. | ||
1870 | 1868 | ||
1871 | The intent of the cifs module is to provide an advanced | 1869 | The intent of the cifs module is to provide an advanced |
1872 | network file system client for mounting to CIFS compliant servers, | 1870 | network file system client for mounting to CIFS compliant servers, |
1873 | including support for dfs (hierarchical name space), secure per-user | 1871 | including support for dfs (hierarchical name space), secure per-user |
1874 | session establishment, safe distributed caching (oplock), optional | 1872 | session establishment, safe distributed caching (oplock), optional |
1875 | packet signing, Unicode and other internationalization improvements, | 1873 | packet signing, Unicode and other internationalization improvements. |
1876 | and optional Winbind (nsswitch) integration. You do not need to enable | 1874 | If you need to mount to Samba or Windows from this machine, say Y. |
1877 | cifs if running only a (Samba) server. It is possible to enable both | ||
1878 | smbfs and cifs (e.g. if you are using CIFS for accessing Windows 2003 | ||
1879 | and Samba 3 servers, and smbfs for accessing old servers). If you need | ||
1880 | to mount to Samba or Windows from this machine, say Y. | ||
1881 | 1875 | ||
1882 | config CIFS_STATS | 1876 | config CIFS_STATS |
1883 | bool "CIFS statistics" | 1877 | bool "CIFS statistics" |
@@ -1970,14 +1964,13 @@ config CIFS_EXPERIMENTAL | |||
1970 | depends on CIFS && EXPERIMENTAL | 1964 | depends on CIFS && EXPERIMENTAL |
1971 | help | 1965 | help |
1972 | Enables cifs features under testing. These features are | 1966 | Enables cifs features under testing. These features are |
1973 | experimental and currently include support for writepages | 1967 | experimental and currently include DFS support and directory |
1974 | (multipage writebehind performance improvements) and directory | 1968 | change notification ie fcntl(F_DNOTIFY), as well as the upcall |
1975 | change notification ie fcntl(F_DNOTIFY) as well as some security | 1969 | mechanism which will be used for Kerberos session negotiation |
1976 | improvements. Some also depend on setting at runtime the | 1970 | and uid remapping. Some of these features also may depend on |
1977 | pseudo-file /proc/fs/cifs/Experimental (which is disabled by | 1971 | setting a value of 1 to the pseudo-file /proc/fs/cifs/Experimental |
1978 | default). See the file fs/cifs/README for more details. | 1972 | (which is disabled by default). See the file fs/cifs/README |
1979 | 1973 | for more details. If unsure, say N. | |
1980 | If unsure, say N. | ||
1981 | 1974 | ||
1982 | config CIFS_UPCALL | 1975 | config CIFS_UPCALL |
1983 | bool "Kerberos/SPNEGO advanced session setup (EXPERIMENTAL)" | 1976 | bool "Kerberos/SPNEGO advanced session setup (EXPERIMENTAL)" |
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 85e3850bf2c9..5fe13593b57f 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -1,8 +1,15 @@ | |||
1 | Version 1.47 | 1 | Version 1.47 |
2 | ------------ | 2 | ------------ |
3 | Fix oops in list_del during mount caused by unaligned string. | 3 | Fix oops in list_del during mount caused by unaligned string. |
4 | Fix file corruption which could occur on some large file | ||
5 | copies caused by writepages page i/o completion bug. | ||
4 | Seek to SEEK_END forces check for update of file size for non-cached | 6 | Seek to SEEK_END forces check for update of file size for non-cached |
5 | files. | 7 | files. Allow file size to be updated on remote extend of locally open, |
8 | non-cached file. Fix reconnect to newer Samba servers (or other servers | ||
9 | which support the CIFS Unix/POSIX extensions) so that we again tell the | ||
10 | server the Unix/POSIX cifs capabilities which we support (SetFSInfo). | ||
11 | Add experimental support for new POSIX Open/Mkdir (which returns | ||
12 | stat information on the open, and allows setting the mode). | ||
6 | 13 | ||
7 | Version 1.46 | 14 | Version 1.46 |
8 | ------------ | 15 | ------------ |
diff --git a/fs/cifs/TODO b/fs/cifs/TODO index fc34c74ec4be..68372946dc92 100644 --- a/fs/cifs/TODO +++ b/fs/cifs/TODO | |||
@@ -128,3 +128,11 @@ negotiated size) and send larger write sizes to modern servers. | |||
128 | 128 | ||
129 | 4) More exhaustively test against less common servers. More testing | 129 | 4) More exhaustively test against less common servers. More testing |
130 | against Windows 9x, Windows ME servers. | 130 | against Windows 9x, Windows ME servers. |
131 | |||
132 | DOS attrs - returned as pseudo-xattr in Samba format (check VFAT and NTFS for this too) | ||
133 | |||
134 | mount check for unmatched uids - and uid override | ||
135 | |||
136 | Add mount option for Linux extension disable per mount, and partial disable per mount (uid off, symlink/fifo/mknod on but what about posix acls?) | ||
137 | |||
138 | Free threads at umount --force that are stuck on the sesSem | ||
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 01ae24af9cfd..c97c08eb481a 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -100,5 +100,5 @@ extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t); | |||
100 | extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); | 100 | extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); |
101 | extern int cifs_ioctl (struct inode * inode, struct file * filep, | 101 | extern int cifs_ioctl (struct inode * inode, struct file * filep, |
102 | unsigned int command, unsigned long arg); | 102 | unsigned int command, unsigned long arg); |
103 | #define CIFS_VERSION "1.47" | 103 | #define CIFS_VERSION "1.48" |
104 | #endif /* _CIFSFS_H */ | 104 | #endif /* _CIFSFS_H */ |
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index 068ef51edbf7..7d9505491b16 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * fs/cifs/cifspdu.h | 2 | * fs/cifs/cifspdu.h |
3 | * | 3 | * |
4 | * Copyright (c) International Business Machines Corp., 2002,2005 | 4 | * Copyright (c) International Business Machines Corp., 2002,2007 |
5 | * Author(s): Steve French (sfrench@us.ibm.com) | 5 | * Author(s): Steve French (sfrench@us.ibm.com) |
6 | * | 6 | * |
7 | * This library is free software; you can redistribute it and/or modify | 7 | * This library is free software; you can redistribute it and/or modify |
@@ -544,7 +544,8 @@ typedef union smb_com_session_setup_andx { | |||
544 | /* unsigned char * NativeOS; */ | 544 | /* unsigned char * NativeOS; */ |
545 | /* unsigned char * NativeLanMan; */ | 545 | /* unsigned char * NativeLanMan; */ |
546 | /* unsigned char * PrimaryDomain; */ | 546 | /* unsigned char * PrimaryDomain; */ |
547 | } __attribute__((packed)) resp; /* NTLM response with or without extended sec*/ | 547 | } __attribute__((packed)) resp; /* NTLM response |
548 | (with or without extended sec) */ | ||
548 | 549 | ||
549 | struct { /* request format */ | 550 | struct { /* request format */ |
550 | struct smb_hdr hdr; /* wct = 10 */ | 551 | struct smb_hdr hdr; /* wct = 10 */ |
@@ -795,6 +796,8 @@ typedef struct smb_com_openx_rsp { | |||
795 | __u16 ByteCount; | 796 | __u16 ByteCount; |
796 | } __attribute__((packed)) OPENX_RSP; | 797 | } __attribute__((packed)) OPENX_RSP; |
797 | 798 | ||
799 | /* For encoding of POSIX Open Request - see trans2 function 0x209 data struct */ | ||
800 | |||
798 | /* Legacy write request for older servers */ | 801 | /* Legacy write request for older servers */ |
799 | typedef struct smb_com_writex_req { | 802 | typedef struct smb_com_writex_req { |
800 | struct smb_hdr hdr; /* wct = 12 */ | 803 | struct smb_hdr hdr; /* wct = 12 */ |
@@ -1352,11 +1355,13 @@ struct smb_t2_rsp { | |||
1352 | #define SMB_QUERY_FILE_UNIX_BASIC 0x200 | 1355 | #define SMB_QUERY_FILE_UNIX_BASIC 0x200 |
1353 | #define SMB_QUERY_FILE_UNIX_LINK 0x201 | 1356 | #define SMB_QUERY_FILE_UNIX_LINK 0x201 |
1354 | #define SMB_QUERY_POSIX_ACL 0x204 | 1357 | #define SMB_QUERY_POSIX_ACL 0x204 |
1355 | #define SMB_QUERY_XATTR 0x205 | 1358 | #define SMB_QUERY_XATTR 0x205 /* e.g. system EA name space */ |
1356 | #define SMB_QUERY_ATTR_FLAGS 0x206 /* append,immutable etc. */ | 1359 | #define SMB_QUERY_ATTR_FLAGS 0x206 /* append,immutable etc. */ |
1357 | #define SMB_QUERY_POSIX_PERMISSION 0x207 | 1360 | #define SMB_QUERY_POSIX_PERMISSION 0x207 |
1358 | #define SMB_QUERY_POSIX_LOCK 0x208 | 1361 | #define SMB_QUERY_POSIX_LOCK 0x208 |
1359 | /* #define SMB_POSIX_OPEN 0x209 */ | 1362 | /* #define SMB_POSIX_OPEN 0x209 */ |
1363 | /* #define SMB_POSIX_UNLINK 0x20a */ | ||
1364 | #define SMB_QUERY_FILE__UNIX_INFO2 0x20b | ||
1360 | #define SMB_QUERY_FILE_INTERNAL_INFO 0x3ee | 1365 | #define SMB_QUERY_FILE_INTERNAL_INFO 0x3ee |
1361 | #define SMB_QUERY_FILE_ACCESS_INFO 0x3f0 | 1366 | #define SMB_QUERY_FILE_ACCESS_INFO 0x3f0 |
1362 | #define SMB_QUERY_FILE_NAME_INFO2 0x3f1 /* 0x30 bytes */ | 1367 | #define SMB_QUERY_FILE_NAME_INFO2 0x3f1 /* 0x30 bytes */ |
@@ -1377,8 +1382,10 @@ struct smb_t2_rsp { | |||
1377 | #define SMB_SET_ATTR_FLAGS 0x206 /* append, immutable etc. */ | 1382 | #define SMB_SET_ATTR_FLAGS 0x206 /* append, immutable etc. */ |
1378 | #define SMB_SET_POSIX_LOCK 0x208 | 1383 | #define SMB_SET_POSIX_LOCK 0x208 |
1379 | #define SMB_POSIX_OPEN 0x209 | 1384 | #define SMB_POSIX_OPEN 0x209 |
1385 | #define SMB_POSIX_UNLINK 0x20a | ||
1386 | #define SMB_SET_FILE_UNIX_INFO2 | ||
1380 | #define SMB_SET_FILE_BASIC_INFO2 0x3ec | 1387 | #define SMB_SET_FILE_BASIC_INFO2 0x3ec |
1381 | #define SMB_SET_FILE_RENAME_INFORMATION 0x3f2 /* BB check if qpathinfo level too */ | 1388 | #define SMB_SET_FILE_RENAME_INFORMATION 0x3f2 /* BB check if qpathinfo too */ |
1382 | #define SMB_FILE_ALL_INFO2 0x3fa | 1389 | #define SMB_FILE_ALL_INFO2 0x3fa |
1383 | #define SMB_SET_FILE_ALLOCATION_INFO2 0x3fb | 1390 | #define SMB_SET_FILE_ALLOCATION_INFO2 0x3fb |
1384 | #define SMB_SET_FILE_END_OF_FILE_INFO2 0x3fc | 1391 | #define SMB_SET_FILE_END_OF_FILE_INFO2 0x3fc |
@@ -1428,7 +1435,7 @@ typedef struct smb_com_transaction2_qpi_rsp { | |||
1428 | struct smb_hdr hdr; /* wct = 10 + SetupCount */ | 1435 | struct smb_hdr hdr; /* wct = 10 + SetupCount */ |
1429 | struct trans2_resp t2; | 1436 | struct trans2_resp t2; |
1430 | __u16 ByteCount; | 1437 | __u16 ByteCount; |
1431 | __u16 Reserved2; /* parameter word reserved - present for infolevels > 100 */ | 1438 | __u16 Reserved2; /* parameter word is present for infolevels > 100 */ |
1432 | } __attribute__((packed)) TRANSACTION2_QPI_RSP; | 1439 | } __attribute__((packed)) TRANSACTION2_QPI_RSP; |
1433 | 1440 | ||
1434 | typedef struct smb_com_transaction2_spi_req { | 1441 | typedef struct smb_com_transaction2_spi_req { |
@@ -1461,7 +1468,7 @@ typedef struct smb_com_transaction2_spi_rsp { | |||
1461 | struct smb_hdr hdr; /* wct = 10 + SetupCount */ | 1468 | struct smb_hdr hdr; /* wct = 10 + SetupCount */ |
1462 | struct trans2_resp t2; | 1469 | struct trans2_resp t2; |
1463 | __u16 ByteCount; | 1470 | __u16 ByteCount; |
1464 | __u16 Reserved2; /* parameter word reserved - present for infolevels > 100 */ | 1471 | __u16 Reserved2; /* parameter word is present for infolevels > 100 */ |
1465 | } __attribute__((packed)) TRANSACTION2_SPI_RSP; | 1472 | } __attribute__((packed)) TRANSACTION2_SPI_RSP; |
1466 | 1473 | ||
1467 | struct set_file_rename { | 1474 | struct set_file_rename { |
@@ -1627,6 +1634,7 @@ typedef struct smb_com_transaction2_fnext_rsp_parms { | |||
1627 | #define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105 | 1634 | #define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105 |
1628 | #define SMB_QUERY_CIFS_UNIX_INFO 0x200 | 1635 | #define SMB_QUERY_CIFS_UNIX_INFO 0x200 |
1629 | #define SMB_QUERY_POSIX_FS_INFO 0x201 | 1636 | #define SMB_QUERY_POSIX_FS_INFO 0x201 |
1637 | #define SMB_QUERY_POSIX_WHO_AM_I 0x202 | ||
1630 | #define SMB_QUERY_LABEL_INFO 0x3ea | 1638 | #define SMB_QUERY_LABEL_INFO 0x3ea |
1631 | #define SMB_QUERY_FS_QUOTA_INFO 0x3ee | 1639 | #define SMB_QUERY_FS_QUOTA_INFO 0x3ee |
1632 | #define SMB_QUERY_FS_FULL_SIZE_INFO 0x3ef | 1640 | #define SMB_QUERY_FS_FULL_SIZE_INFO 0x3ef |
@@ -1659,9 +1667,21 @@ typedef struct smb_com_transaction_qfsi_rsp { | |||
1659 | struct smb_hdr hdr; /* wct = 10 + SetupCount */ | 1667 | struct smb_hdr hdr; /* wct = 10 + SetupCount */ |
1660 | struct trans2_resp t2; | 1668 | struct trans2_resp t2; |
1661 | __u16 ByteCount; | 1669 | __u16 ByteCount; |
1662 | __u8 Pad; /* may be three bytes *//* followed by data area */ | 1670 | __u8 Pad; /* may be three bytes? *//* followed by data area */ |
1663 | } __attribute__((packed)) TRANSACTION2_QFSI_RSP; | 1671 | } __attribute__((packed)) TRANSACTION2_QFSI_RSP; |
1664 | 1672 | ||
1673 | typedef struct whoami_rsp_data { /* Query level 0x202 */ | ||
1674 | __u32 flags; /* 0 = Authenticated user 1 = GUEST */ | ||
1675 | __u32 mask; /* which flags bits server understands ie 0x0001 */ | ||
1676 | __u64 unix_user_id; | ||
1677 | __u64 unix_user_gid; | ||
1678 | __u32 number_of_supplementary_gids; /* may be zero */ | ||
1679 | __u32 number_of_sids; /* may be zero */ | ||
1680 | __u32 length_of_sid_array; /* in bytes - may be zero */ | ||
1681 | __u32 pad; /* reserved - MBZ */ | ||
1682 | /* __u64 gid_array[0]; */ /* may be empty */ | ||
1683 | /* __u8 * psid_list */ /* may be empty */ | ||
1684 | } __attribute__((packed)) WHOAMI_RSP_DATA; | ||
1665 | 1685 | ||
1666 | /* SETFSInfo Levels */ | 1686 | /* SETFSInfo Levels */ |
1667 | #define SMB_SET_CIFS_UNIX_INFO 0x200 | 1687 | #define SMB_SET_CIFS_UNIX_INFO 0x200 |
@@ -1858,8 +1878,11 @@ typedef struct { | |||
1858 | #define CIFS_UNIX_XATTR_CAP 0x00000004 /* support new namespace */ | 1878 | #define CIFS_UNIX_XATTR_CAP 0x00000004 /* support new namespace */ |
1859 | #define CIFS_UNIX_EXTATTR_CAP 0x00000008 /* support chattr/chflag */ | 1879 | #define CIFS_UNIX_EXTATTR_CAP 0x00000008 /* support chattr/chflag */ |
1860 | #define CIFS_UNIX_POSIX_PATHNAMES_CAP 0x00000010 /* Allow POSIX path chars */ | 1880 | #define CIFS_UNIX_POSIX_PATHNAMES_CAP 0x00000010 /* Allow POSIX path chars */ |
1881 | #define CIFS_UNIX_POSIX_PATH_OPS_CAP 0x00000020 /* Allow new POSIX path based | ||
1882 | calls including posix open | ||
1883 | and posix unlink */ | ||
1861 | #ifdef CONFIG_CIFS_POSIX | 1884 | #ifdef CONFIG_CIFS_POSIX |
1862 | #define CIFS_UNIX_CAP_MASK 0x0000001b | 1885 | #define CIFS_UNIX_CAP_MASK 0x0000003b |
1863 | #else | 1886 | #else |
1864 | #define CIFS_UNIX_CAP_MASK 0x00000013 | 1887 | #define CIFS_UNIX_CAP_MASK 0x00000013 |
1865 | #endif /* CONFIG_CIFS_POSIX */ | 1888 | #endif /* CONFIG_CIFS_POSIX */ |
@@ -1946,7 +1969,7 @@ typedef struct { /* data block encoding of response to level 263 QPathInfo */ | |||
1946 | __le32 AlignmentRequirement; | 1969 | __le32 AlignmentRequirement; |
1947 | __le32 FileNameLength; | 1970 | __le32 FileNameLength; |
1948 | char FileName[1]; | 1971 | char FileName[1]; |
1949 | } __attribute__((packed)) FILE_ALL_INFO; /* level 0x107 QPathInfo */ | 1972 | } __attribute__((packed)) FILE_ALL_INFO; /* level 0x107 QPathInfo */ |
1950 | 1973 | ||
1951 | /* defines for enumerating possible values of the Unix type field below */ | 1974 | /* defines for enumerating possible values of the Unix type field below */ |
1952 | #define UNIX_FILE 0 | 1975 | #define UNIX_FILE 0 |
@@ -1970,11 +1993,11 @@ typedef struct { | |||
1970 | __u64 UniqueId; | 1993 | __u64 UniqueId; |
1971 | __le64 Permissions; | 1994 | __le64 Permissions; |
1972 | __le64 Nlinks; | 1995 | __le64 Nlinks; |
1973 | } __attribute__((packed)) FILE_UNIX_BASIC_INFO; /* level 0x200 QPathInfo */ | 1996 | } __attribute__((packed)) FILE_UNIX_BASIC_INFO; /* level 0x200 QPathInfo */ |
1974 | 1997 | ||
1975 | typedef struct { | 1998 | typedef struct { |
1976 | char LinkDest[1]; | 1999 | char LinkDest[1]; |
1977 | } __attribute__((packed)) FILE_UNIX_LINK_INFO; /* level 0x201 QPathInfo */ | 2000 | } __attribute__((packed)) FILE_UNIX_LINK_INFO; /* level 0x201 QPathInfo */ |
1978 | 2001 | ||
1979 | /* The following three structures are needed only for | 2002 | /* The following three structures are needed only for |
1980 | setting time to NT4 and some older servers via | 2003 | setting time to NT4 and some older servers via |
@@ -2011,7 +2034,7 @@ typedef struct { | |||
2011 | __le64 ChangeTime; | 2034 | __le64 ChangeTime; |
2012 | __le32 Attributes; | 2035 | __le32 Attributes; |
2013 | __u32 Pad; | 2036 | __u32 Pad; |
2014 | } __attribute__((packed)) FILE_BASIC_INFO; /* size info, level 0x101 */ | 2037 | } __attribute__((packed)) FILE_BASIC_INFO; /* size info, level 0x101 */ |
2015 | 2038 | ||
2016 | struct file_allocation_info { | 2039 | struct file_allocation_info { |
2017 | __le64 AllocationSize; /* Note old Samba srvr rounds this up too much */ | 2040 | __le64 AllocationSize; /* Note old Samba srvr rounds this up too much */ |
@@ -2020,7 +2043,7 @@ struct file_allocation_info { | |||
2020 | 2043 | ||
2021 | struct file_end_of_file_info { | 2044 | struct file_end_of_file_info { |
2022 | __le64 FileSize; /* offset to end of file */ | 2045 | __le64 FileSize; /* offset to end of file */ |
2023 | } __attribute__((packed)); /* size info, level 0x104 for set, 0x106 for query */ | 2046 | } __attribute__((packed)); /* size info, level 0x104 for set, 0x106 for query */ |
2024 | 2047 | ||
2025 | struct file_alt_name_info { | 2048 | struct file_alt_name_info { |
2026 | __u8 alt_name[1]; | 2049 | __u8 alt_name[1]; |
@@ -2075,6 +2098,19 @@ struct cifs_posix_acl { /* access conrol list (ACL) */ | |||
2075 | 2098 | ||
2076 | /* end of POSIX ACL definitions */ | 2099 | /* end of POSIX ACL definitions */ |
2077 | 2100 | ||
2101 | typedef struct { | ||
2102 | __u32 OpenFlags; /* same as NT CreateX */ | ||
2103 | __u32 PosixOpenFlags; | ||
2104 | __u32 Mode; | ||
2105 | __u16 Level; /* reply level requested (see QPathInfo levels) */ | ||
2106 | __u16 Pad; /* reserved - MBZ */ | ||
2107 | } __attribute__((packed)) OPEN_PSX_REQ; /* level 0x209 SetPathInfo data */ | ||
2108 | |||
2109 | typedef struct { | ||
2110 | /* reply varies based on requested level */ | ||
2111 | } __attribute__((packed)) OPEN_PSX_RSP; /* level 0x209 SetPathInfo data */ | ||
2112 | |||
2113 | |||
2078 | struct file_internal_info { | 2114 | struct file_internal_info { |
2079 | __u64 UniqueId; /* inode number */ | 2115 | __u64 UniqueId; /* inode number */ |
2080 | } __attribute__((packed)); /* level 0x3ee */ | 2116 | } __attribute__((packed)); /* level 0x3ee */ |
@@ -2238,7 +2274,8 @@ struct data_blob { | |||
2238 | 1) PosixCreateX - to set and return the mode, inode#, device info and | 2274 | 1) PosixCreateX - to set and return the mode, inode#, device info and |
2239 | perhaps add a CreateDevice - to create Pipes and other special .inodes | 2275 | perhaps add a CreateDevice - to create Pipes and other special .inodes |
2240 | Also note POSIX open flags | 2276 | Also note POSIX open flags |
2241 | 2) Close - to return the last write time to do cache across close more safely | 2277 | 2) Close - to return the last write time to do cache across close |
2278 | more safely | ||
2242 | 3) FindFirst return unique inode number - what about resume key, two | 2279 | 3) FindFirst return unique inode number - what about resume key, two |
2243 | forms short (matches readdir) and full (enough info to cache inodes) | 2280 | forms short (matches readdir) and full (enough info to cache inodes) |
2244 | 4) Mkdir - set mode | 2281 | 4) Mkdir - set mode |
@@ -2273,7 +2310,8 @@ struct data_blob { | |||
2273 | TRANSACTION2 (18 cases) | 2310 | TRANSACTION2 (18 cases) |
2274 | SMB_SET_FILE_END_OF_FILE_INFO2 SMB_SET_PATH_END_OF_FILE_INFO2 | 2311 | SMB_SET_FILE_END_OF_FILE_INFO2 SMB_SET_PATH_END_OF_FILE_INFO2 |
2275 | (BB verify that never need to set allocation size) | 2312 | (BB verify that never need to set allocation size) |
2276 | SMB_SET_FILE_BASIC_INFO2 (setting times - BB can it be done via Unix ext?) | 2313 | SMB_SET_FILE_BASIC_INFO2 (setting times - BB can it be done via |
2314 | Unix ext?) | ||
2277 | 2315 | ||
2278 | COPY (note support for copy across directories) - FUTURE, OPTIONAL | 2316 | COPY (note support for copy across directories) - FUTURE, OPTIONAL |
2279 | setting/getting OS/2 EAs - FUTURE (BB can this handle | 2317 | setting/getting OS/2 EAs - FUTURE (BB can this handle |
@@ -2293,13 +2331,13 @@ struct data_blob { | |||
2293 | T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_BASIC) - BB check for missing inode fields | 2331 | T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_BASIC) - BB check for missing inode fields |
2294 | Actually need QUERY_FILE_UNIX_INFO since has inode num | 2332 | Actually need QUERY_FILE_UNIX_INFO since has inode num |
2295 | BB what about a) blksize/blkbits/blocks | 2333 | BB what about a) blksize/blkbits/blocks |
2296 | b) i_version | 2334 | b) i_version |
2297 | c) i_rdev | 2335 | c) i_rdev |
2298 | d) notify mask? | 2336 | d) notify mask? |
2299 | e) generation | 2337 | e) generation |
2300 | f) size_seqcount | 2338 | f) size_seqcount |
2301 | T2 FIND_FIRST/FIND_NEXT FIND_FILE_UNIX | 2339 | T2 FIND_FIRST/FIND_NEXT FIND_FILE_UNIX |
2302 | TRANS2_GET_DFS_REFERRAL - OPTIONAL but recommended | 2340 | TRANS2_GET_DFS_REFERRAL - OPTIONAL but recommended |
2303 | T2_QFS_INFO QueryDevice/AttributeInfo - OPTIONAL | 2341 | T2_QFS_INFO QueryDevice/AttributeInfo - OPTIONAL |
2304 | 2342 | ||
2305 | 2343 | ||
@@ -2338,7 +2376,7 @@ typedef struct file_xattr_info { | |||
2338 | __u32 xattr_value_len; | 2376 | __u32 xattr_value_len; |
2339 | char xattr_name[0]; | 2377 | char xattr_name[0]; |
2340 | /* followed by xattr_value[xattr_value_len], no pad */ | 2378 | /* followed by xattr_value[xattr_value_len], no pad */ |
2341 | } __attribute__((packed)) FILE_XATTR_INFO; /* extended attribute, info level 0x205 */ | 2379 | } __attribute__((packed)) FILE_XATTR_INFO; /* extended attribute, info level 0x205 */ |
2342 | 2380 | ||
2343 | 2381 | ||
2344 | /* flags for chattr command */ | 2382 | /* flags for chattr command */ |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index f1f8225102f0..6148b82170c4 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/nls.h> | 23 | #include <linux/nls.h> |
24 | 24 | ||
25 | struct statfs; | 25 | struct statfs; |
26 | struct smb_vol; | ||
26 | 27 | ||
27 | /* | 28 | /* |
28 | ***************************************************************** | 29 | ***************************************************************** |
@@ -57,7 +58,7 @@ extern int SendReceiveBlockingLock(const unsigned int /* xid */ , | |||
57 | int * /* bytes returned */); | 58 | int * /* bytes returned */); |
58 | extern int checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length); | 59 | extern int checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length); |
59 | extern int is_valid_oplock_break(struct smb_hdr *smb, struct TCP_Server_Info *); | 60 | extern int is_valid_oplock_break(struct smb_hdr *smb, struct TCP_Server_Info *); |
60 | extern int is_size_safe_to_change(struct cifsInodeInfo *); | 61 | extern int is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof); |
61 | extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *); | 62 | extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *); |
62 | extern unsigned int smbCalcSize(struct smb_hdr *ptr); | 63 | extern unsigned int smbCalcSize(struct smb_hdr *ptr); |
63 | extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); | 64 | extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); |
@@ -147,6 +148,8 @@ extern int get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, | |||
147 | unsigned int *pnum_referrals, | 148 | unsigned int *pnum_referrals, |
148 | unsigned char ** preferrals, | 149 | unsigned char ** preferrals, |
149 | int remap); | 150 | int remap); |
151 | extern void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon, | ||
152 | struct super_block * sb, struct smb_vol * vol); | ||
150 | extern int CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon, | 153 | extern int CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon, |
151 | struct kstatfs *FSData); | 154 | struct kstatfs *FSData); |
152 | extern int SMBOldQFSInfo(const int xid, struct cifsTconInfo *tcon, | 155 | extern int SMBOldQFSInfo(const int xid, struct cifsTconInfo *tcon, |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 472e33e0f3cf..b8e91470c27f 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -158,9 +158,15 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, | |||
158 | nls_codepage); | 158 | nls_codepage); |
159 | if(!rc && (tcon->tidStatus == CifsNeedReconnect)) { | 159 | if(!rc && (tcon->tidStatus == CifsNeedReconnect)) { |
160 | mark_open_files_invalid(tcon); | 160 | mark_open_files_invalid(tcon); |
161 | rc = CIFSTCon(0, tcon->ses, tcon->treeName, tcon | 161 | rc = CIFSTCon(0, tcon->ses, tcon->treeName, |
162 | , nls_codepage); | 162 | tcon, nls_codepage); |
163 | up(&tcon->ses->sesSem); | 163 | up(&tcon->ses->sesSem); |
164 | /* tell server which Unix caps we support */ | ||
165 | if (tcon->ses->capabilities & CAP_UNIX) | ||
166 | reset_cifs_unix_caps(0 /* no xid */, | ||
167 | tcon, | ||
168 | NULL /* we do not know sb */, | ||
169 | NULL /* no vol info */); | ||
164 | /* BB FIXME add code to check if wsize needs | 170 | /* BB FIXME add code to check if wsize needs |
165 | update due to negotiated smb buffer size | 171 | update due to negotiated smb buffer size |
166 | shrinking */ | 172 | shrinking */ |
@@ -298,6 +304,12 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, | |||
298 | rc = CIFSTCon(0, tcon->ses, tcon->treeName, | 304 | rc = CIFSTCon(0, tcon->ses, tcon->treeName, |
299 | tcon, nls_codepage); | 305 | tcon, nls_codepage); |
300 | up(&tcon->ses->sesSem); | 306 | up(&tcon->ses->sesSem); |
307 | /* tell server which Unix caps we support */ | ||
308 | if (tcon->ses->capabilities & CAP_UNIX) | ||
309 | reset_cifs_unix_caps(0 /* no xid */, | ||
310 | tcon, | ||
311 | NULL /* do not know sb */, | ||
312 | NULL /* no vol info */); | ||
301 | /* BB FIXME add code to check if wsize needs | 313 | /* BB FIXME add code to check if wsize needs |
302 | update due to negotiated smb buffer size | 314 | update due to negotiated smb buffer size |
303 | shrinking */ | 315 | shrinking */ |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 2caca06b4bae..20ba7dcc9959 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -1613,6 +1613,76 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket) | |||
1613 | return rc; | 1613 | return rc; |
1614 | } | 1614 | } |
1615 | 1615 | ||
1616 | void reset_cifs_unix_caps(int xid, struct cifsTconInfo * tcon, | ||
1617 | struct super_block * sb, struct smb_vol * vol_info) | ||
1618 | { | ||
1619 | /* if we are reconnecting then should we check to see if | ||
1620 | * any requested capabilities changed locally e.g. via | ||
1621 | * remount but we can not do much about it here | ||
1622 | * if they have (even if we could detect it by the following) | ||
1623 | * Perhaps we could add a backpointer to array of sb from tcon | ||
1624 | * or if we change to make all sb to same share the same | ||
1625 | * sb as NFS - then we only have one backpointer to sb. | ||
1626 | * What if we wanted to mount the server share twice once with | ||
1627 | * and once without posixacls or posix paths? */ | ||
1628 | __u64 saved_cap = le64_to_cpu(tcon->fsUnixInfo.Capability); | ||
1629 | |||
1630 | |||
1631 | if(!CIFSSMBQFSUnixInfo(xid, tcon)) { | ||
1632 | __u64 cap = le64_to_cpu(tcon->fsUnixInfo.Capability); | ||
1633 | |||
1634 | /* check for reconnect case in which we do not | ||
1635 | want to change the mount behavior if we can avoid it */ | ||
1636 | if(vol_info == NULL) { | ||
1637 | /* turn off POSIX ACL and PATHNAMES if not set | ||
1638 | originally at mount time */ | ||
1639 | if ((saved_cap & CIFS_UNIX_POSIX_ACL_CAP) == 0) | ||
1640 | cap &= ~CIFS_UNIX_POSIX_ACL_CAP; | ||
1641 | if ((saved_cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) == 0) | ||
1642 | cap &= ~CIFS_UNIX_POSIX_PATHNAMES_CAP; | ||
1643 | |||
1644 | |||
1645 | |||
1646 | |||
1647 | } | ||
1648 | |||
1649 | cap &= CIFS_UNIX_CAP_MASK; | ||
1650 | if(vol_info && vol_info->no_psx_acl) | ||
1651 | cap &= ~CIFS_UNIX_POSIX_ACL_CAP; | ||
1652 | else if(CIFS_UNIX_POSIX_ACL_CAP & cap) { | ||
1653 | cFYI(1,("negotiated posix acl support")); | ||
1654 | if(sb) | ||
1655 | sb->s_flags |= MS_POSIXACL; | ||
1656 | } | ||
1657 | |||
1658 | if(vol_info && vol_info->posix_paths == 0) | ||
1659 | cap &= ~CIFS_UNIX_POSIX_PATHNAMES_CAP; | ||
1660 | else if(cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) { | ||
1661 | cFYI(1,("negotiate posix pathnames")); | ||
1662 | if(sb) | ||
1663 | CIFS_SB(sb)->mnt_cifs_flags |= | ||
1664 | CIFS_MOUNT_POSIX_PATHS; | ||
1665 | } | ||
1666 | |||
1667 | cFYI(1,("Negotiate caps 0x%x",(int)cap)); | ||
1668 | #ifdef CONFIG_CIFS_DEBUG2 | ||
1669 | if(cap & CIFS_UNIX_FCNTL_CAP) | ||
1670 | cFYI(1,("FCNTL cap")); | ||
1671 | if(cap & CIFS_UNIX_EXTATTR_CAP) | ||
1672 | cFYI(1,("EXTATTR cap")); | ||
1673 | if(cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) | ||
1674 | cFYI(1,("POSIX path cap")); | ||
1675 | if(cap & CIFS_UNIX_XATTR_CAP) | ||
1676 | cFYI(1,("XATTR cap")); | ||
1677 | if(cap & CIFS_UNIX_POSIX_ACL_CAP) | ||
1678 | cFYI(1,("POSIX ACL cap")); | ||
1679 | #endif /* CIFS_DEBUG2 */ | ||
1680 | if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) { | ||
1681 | cFYI(1,("setting capabilities failed")); | ||
1682 | } | ||
1683 | } | ||
1684 | } | ||
1685 | |||
1616 | int | 1686 | int |
1617 | cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | 1687 | cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, |
1618 | char *mount_data, const char *devname) | 1688 | char *mount_data, const char *devname) |
@@ -1928,20 +1998,25 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1928 | if (tcon == NULL) | 1998 | if (tcon == NULL) |
1929 | rc = -ENOMEM; | 1999 | rc = -ENOMEM; |
1930 | else { | 2000 | else { |
1931 | /* check for null share name ie connect to dfs root */ | 2001 | /* check for null share name ie connecting to |
2002 | * dfs root */ | ||
1932 | 2003 | ||
1933 | /* BB check if this works for exactly length three strings */ | 2004 | /* BB check if this works for exactly length |
2005 | * three strings */ | ||
1934 | if ((strchr(volume_info.UNC + 3, '\\') == NULL) | 2006 | if ((strchr(volume_info.UNC + 3, '\\') == NULL) |
1935 | && (strchr(volume_info.UNC + 3, '/') == | 2007 | && (strchr(volume_info.UNC + 3, '/') == |
1936 | NULL)) { | 2008 | NULL)) { |
1937 | rc = connect_to_dfs_path(xid, pSesInfo, | 2009 | rc = connect_to_dfs_path(xid, pSesInfo, |
1938 | "", cifs_sb->local_nls, | 2010 | "", cifs_sb->local_nls, |
1939 | cifs_sb->mnt_cifs_flags & | 2011 | cifs_sb->mnt_cifs_flags & |
1940 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 2012 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1941 | kfree(volume_info.UNC); | 2013 | kfree(volume_info.UNC); |
1942 | FreeXid(xid); | 2014 | FreeXid(xid); |
1943 | return -ENODEV; | 2015 | return -ENODEV; |
1944 | } else { | 2016 | } else { |
2017 | /* BB Do we need to wrap sesSem around | ||
2018 | * this TCon call and Unix SetFS as | ||
2019 | * we do on SessSetup and reconnect? */ | ||
1945 | rc = CIFSTCon(xid, pSesInfo, | 2020 | rc = CIFSTCon(xid, pSesInfo, |
1946 | volume_info.UNC, | 2021 | volume_info.UNC, |
1947 | tcon, cifs_sb->local_nls); | 2022 | tcon, cifs_sb->local_nls); |
@@ -1962,6 +2037,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1962 | sb->s_maxbytes = (u64) 1 << 31; /* 2 GB */ | 2037 | sb->s_maxbytes = (u64) 1 << 31; /* 2 GB */ |
1963 | } | 2038 | } |
1964 | 2039 | ||
2040 | /* BB FIXME fix time_gran to be larger for LANMAN sessions */ | ||
1965 | sb->s_time_gran = 100; | 2041 | sb->s_time_gran = 100; |
1966 | 2042 | ||
1967 | /* on error free sesinfo and tcon struct if needed */ | 2043 | /* on error free sesinfo and tcon struct if needed */ |
@@ -2006,45 +2082,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2006 | /* do not care if following two calls succeed - informational */ | 2082 | /* do not care if following two calls succeed - informational */ |
2007 | CIFSSMBQFSDeviceInfo(xid, tcon); | 2083 | CIFSSMBQFSDeviceInfo(xid, tcon); |
2008 | CIFSSMBQFSAttributeInfo(xid, tcon); | 2084 | CIFSSMBQFSAttributeInfo(xid, tcon); |
2009 | 2085 | ||
2010 | if (tcon->ses->capabilities & CAP_UNIX) { | 2086 | /* tell server which Unix caps we support */ |
2011 | if(!CIFSSMBQFSUnixInfo(xid, tcon)) { | 2087 | if (tcon->ses->capabilities & CAP_UNIX) |
2012 | __u64 cap = | 2088 | reset_cifs_unix_caps(xid, tcon, sb, &volume_info); |
2013 | le64_to_cpu(tcon->fsUnixInfo.Capability); | 2089 | |
2014 | cap &= CIFS_UNIX_CAP_MASK; | ||
2015 | if(volume_info.no_psx_acl) | ||
2016 | cap &= ~CIFS_UNIX_POSIX_ACL_CAP; | ||
2017 | else if(CIFS_UNIX_POSIX_ACL_CAP & cap) { | ||
2018 | cFYI(1,("negotiated posix acl support")); | ||
2019 | sb->s_flags |= MS_POSIXACL; | ||
2020 | } | ||
2021 | |||
2022 | if(volume_info.posix_paths == 0) | ||
2023 | cap &= ~CIFS_UNIX_POSIX_PATHNAMES_CAP; | ||
2024 | else if(cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) { | ||
2025 | cFYI(1,("negotiate posix pathnames")); | ||
2026 | cifs_sb->mnt_cifs_flags |= | ||
2027 | CIFS_MOUNT_POSIX_PATHS; | ||
2028 | } | ||
2029 | |||
2030 | cFYI(1,("Negotiate caps 0x%x",(int)cap)); | ||
2031 | #ifdef CONFIG_CIFS_DEBUG2 | ||
2032 | if(cap & CIFS_UNIX_FCNTL_CAP) | ||
2033 | cFYI(1,("FCNTL cap")); | ||
2034 | if(cap & CIFS_UNIX_EXTATTR_CAP) | ||
2035 | cFYI(1,("EXTATTR cap")); | ||
2036 | if(cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) | ||
2037 | cFYI(1,("POSIX path cap")); | ||
2038 | if(cap & CIFS_UNIX_XATTR_CAP) | ||
2039 | cFYI(1,("XATTR cap")); | ||
2040 | if(cap & CIFS_UNIX_POSIX_ACL_CAP) | ||
2041 | cFYI(1,("POSIX ACL cap")); | ||
2042 | #endif /* CIFS_DEBUG2 */ | ||
2043 | if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) { | ||
2044 | cFYI(1,("setting capabilities failed")); | ||
2045 | } | ||
2046 | } | ||
2047 | } | ||
2048 | if (!(tcon->ses->capabilities & CAP_LARGE_WRITE_X)) | 2090 | if (!(tcon->ses->capabilities & CAP_LARGE_WRITE_X)) |
2049 | cifs_sb->wsize = min(cifs_sb->wsize, | 2091 | cifs_sb->wsize = min(cifs_sb->wsize, |
2050 | (tcon->ses->server->maxBuf - | 2092 | (tcon->ses->server->maxBuf - |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index e9dcf5ee29a2..07ff9351e9ee 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -1954,7 +1954,7 @@ static int cifs_readpage(struct file *file, struct page *page) | |||
1954 | refreshing the inode only on increases in the file size | 1954 | refreshing the inode only on increases in the file size |
1955 | but this is tricky to do without racing with writebehind | 1955 | but this is tricky to do without racing with writebehind |
1956 | page caching in the current Linux kernel design */ | 1956 | page caching in the current Linux kernel design */ |
1957 | int is_size_safe_to_change(struct cifsInodeInfo *cifsInode) | 1957 | int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) |
1958 | { | 1958 | { |
1959 | struct cifsFileInfo *open_file = NULL; | 1959 | struct cifsFileInfo *open_file = NULL; |
1960 | 1960 | ||
@@ -1976,6 +1976,9 @@ int is_size_safe_to_change(struct cifsInodeInfo *cifsInode) | |||
1976 | return 1; | 1976 | return 1; |
1977 | } | 1977 | } |
1978 | 1978 | ||
1979 | if(i_size_read(&cifsInode->vfs_inode) < end_of_file) | ||
1980 | return 1; | ||
1981 | |||
1979 | return 0; | 1982 | return 0; |
1980 | } else | 1983 | } else |
1981 | return 1; | 1984 | return 1; |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index c4fa91b8b62f..3f5bc83dc3d1 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -140,7 +140,7 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
140 | inode->i_gid = le64_to_cpu(findData.Gid); | 140 | inode->i_gid = le64_to_cpu(findData.Gid); |
141 | inode->i_nlink = le64_to_cpu(findData.Nlinks); | 141 | inode->i_nlink = le64_to_cpu(findData.Nlinks); |
142 | 142 | ||
143 | if (is_size_safe_to_change(cifsInfo)) { | 143 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { |
144 | /* can not safely change the file size here if the | 144 | /* can not safely change the file size here if the |
145 | client is writing to it due to potential races */ | 145 | client is writing to it due to potential races */ |
146 | 146 | ||
@@ -491,8 +491,8 @@ int cifs_get_inode_info(struct inode **pinode, | |||
491 | /* BB add code here - | 491 | /* BB add code here - |
492 | validate if device or weird share or device type? */ | 492 | validate if device or weird share or device type? */ |
493 | } | 493 | } |
494 | if (is_size_safe_to_change(cifsInfo)) { | 494 | if (is_size_safe_to_change(cifsInfo, le64_to_cpu(pfindData->EndOfFile))) { |
495 | /* can not safely change the file size here if the | 495 | /* can not safely shrink the file size here if the |
496 | client is writing to it due to potential races */ | 496 | client is writing to it due to potential races */ |
497 | i_size_write(inode,le64_to_cpu(pfindData->EndOfFile)); | 497 | i_size_write(inode,le64_to_cpu(pfindData->EndOfFile)); |
498 | 498 | ||
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 782940be550f..c6220bd27165 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -222,7 +222,7 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, | |||
222 | atomic_set(&cifsInfo->inUse, 1); | 222 | atomic_set(&cifsInfo->inUse, 1); |
223 | } | 223 | } |
224 | 224 | ||
225 | if (is_size_safe_to_change(cifsInfo)) { | 225 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { |
226 | /* can not safely change the file size here if the | 226 | /* can not safely change the file size here if the |
227 | client is writing to it due to potential races */ | 227 | client is writing to it due to potential races */ |
228 | i_size_write(tmp_inode, end_of_file); | 228 | i_size_write(tmp_inode, end_of_file); |
@@ -351,10 +351,10 @@ static void unix_fill_in_inode(struct inode *tmp_inode, | |||
351 | tmp_inode->i_gid = le64_to_cpu(pfindData->Gid); | 351 | tmp_inode->i_gid = le64_to_cpu(pfindData->Gid); |
352 | tmp_inode->i_nlink = le64_to_cpu(pfindData->Nlinks); | 352 | tmp_inode->i_nlink = le64_to_cpu(pfindData->Nlinks); |
353 | 353 | ||
354 | if (is_size_safe_to_change(cifsInfo)) { | 354 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { |
355 | /* can not safely change the file size here if the | 355 | /* can not safely change the file size here if the |
356 | client is writing to it due to potential races */ | 356 | client is writing to it due to potential races */ |
357 | i_size_write(tmp_inode,end_of_file); | 357 | i_size_write(tmp_inode, end_of_file); |
358 | 358 | ||
359 | /* 512 bytes (2**9) is the fake blocksize that must be used */ | 359 | /* 512 bytes (2**9) is the fake blocksize that must be used */ |
360 | /* for this calculation, not the real blocksize */ | 360 | /* for this calculation, not the real blocksize */ |