Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
authorLinus Torvalds <torvalds@g5.osdl.org>
Fri, 13 Oct 2006 15:09:29 +0000 (08:09 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 13 Oct 2006 15:09:29 +0000 (08:09 -0700)
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6: (27 commits)
  [CIFS] Missing flags2 for DFS
  [CIFS] Workaround incomplete byte length returned by some
  [CIFS] cifs Kconfig: don't select CONNECTOR
  [CIFS] Level 1 QPathInfo needed for proper OS2 support
  [CIFS] fix typo in previous patch
  [CIFS] Fix old DOS time conversion to handle timezone
  [CIFS] Do not need to adjust for Jan/Feb for leap day
  [CIFS] Fix leaps year calculation for years after 2100
  [CIFS] readdir (ffirst) enablement of accurate timestamps from legacy servers
  [CIFS] Fix compiler warning with previous patch
  [CIFS] Fix typo
  [CIFS] Allow for 15 minute TZs (e.g. Nepal) and be more explicit about
  [CIFS] Fix readdir of large directories for backlevel servers
  [CIFS] Allow LANMAN21 support even in both POSIX non-POSIX path
  [CIFS] Make use of newer QFSInfo dependent on capability bit instead of
  [CIFS] Do not send newer QFSInfo to legacy servers which can not support it
  [CIFS] Fix typo in name of new cifs_show_stats
  [CIFS] Rename server time zone field
  [CIFS] Handle legacy servers which return undefined time zone
  [CIFS] CIFS support for /proc/<pid>/mountstats part 1
  ...

Manual conflict resolution in fs/cifs/connect.c

1  2 
fs/Kconfig
fs/cifs/cifsfs.c
fs/cifs/connect.c
fs/cifs/inode.c
fs/cifs/readdir.c
fs/cifs/sess.c

diff --combined fs/Kconfig
index db4d13324c369eac7d1a77551679071aea7d07de,6865a33544d538b29c6858ede8786a9e3a21550e..6a3df055280a01858d5925f491bcc33157498aab
@@@ -4,8 -4,6 +4,8 @@@
  
  menu "File systems"
  
 +if BLOCK
 +
  config EXT2_FS
        tristate "Second extended fs support"
        help
@@@ -74,11 -72,11 +74,11 @@@ config EXT3_F
        tristate "Ext3 journalling file system support"
        select JBD
        help
 -        This is the journaling version of the Second extended file system
 +        This is the journalling version of the Second extended file system
          (often called ext3), the de facto standard Linux file system
          (method to organize files on a storage device) for hard disks.
  
 -        The journaling code included in this driver means you do not have
 +        The journalling code included in this driver means you do not have
          to run e2fsck (file system checker) on your file systems after a
          crash.  The journal keeps track of any changes that were being made
          at the time the system crashed, and can ensure that your file system
@@@ -140,77 -138,10 +140,77 @@@ config EXT3_FS_SECURIT
          If you are not using a security module that requires using
          extended attributes for file security labels, say N.
  
 +config EXT4DEV_FS
 +      tristate "Ext4dev/ext4 extended fs support development (EXPERIMENTAL)"
 +      depends on EXPERIMENTAL
 +      select JBD2
 +      help
 +        Ext4dev is a predecessor filesystem of the next generation
 +        extended fs ext4, based on ext3 filesystem code. It will be
 +        renamed ext4 fs later, once ext4dev is mature and stabilized.
 +
 +        Unlike the change from ext2 filesystem to ext3 filesystem,
 +        the on-disk format of ext4dev is not the same as ext3 any more:
 +        it is based on extent maps and it supports 48-bit physical block
 +        numbers. These combined on-disk format changes will allow
 +        ext4dev/ext4 to handle more than 16 TB filesystem volumes --
 +        a hard limit that ext3 cannot overcome without changing the
 +        on-disk format.
 +
 +        Other than extent maps and 48-bit block numbers, ext4dev also is
 +        likely to have other new features such as persistent preallocation,
 +        high resolution time stamps, and larger file support etc.  These
 +        features will be added to ext4dev gradually.
 +
 +        To compile this file system support as a module, choose M here. The
 +        module will be called ext4dev.  Be aware, however, that the filesystem
 +        of your root partition (the one containing the directory /) cannot
 +        be compiled as a module, and so this could be dangerous.
 +
 +        If unsure, say N.
 +
 +config EXT4DEV_FS_XATTR
 +      bool "Ext4dev extended attributes"
 +      depends on EXT4DEV_FS
 +      default y
 +      help
 +        Extended attributes are name:value pairs associated with inodes by
 +        the kernel or by users (see the attr(5) manual page, or visit
 +        <http://acl.bestbits.at/> for details).
 +
 +        If unsure, say N.
 +
 +        You need this for POSIX ACL support on ext4dev/ext4.
 +
 +config EXT4DEV_FS_POSIX_ACL
 +      bool "Ext4dev POSIX Access Control Lists"
 +      depends on EXT4DEV_FS_XATTR
 +      select FS_POSIX_ACL
 +      help
 +        POSIX Access Control Lists (ACLs) support permissions for users and
 +        groups beyond the owner/group/world scheme.
 +
 +        To learn more about Access Control Lists, visit the POSIX ACLs for
 +        Linux website <http://acl.bestbits.at/>.
 +
 +        If you don't know what Access Control Lists are, say N
 +
 +config EXT4DEV_FS_SECURITY
 +      bool "Ext4dev Security Labels"
 +      depends on EXT4DEV_FS_XATTR
 +      help
 +        Security labels support alternative access control models
 +        implemented by security modules like SELinux.  This option
 +        enables an extended attribute handler for file security
 +        labels in the ext4dev/ext4 filesystem.
 +
 +        If you are not using a security module that requires using
 +        extended attributes for file security labels, say N.
 +
  config JBD
        tristate
        help
 -        This is a generic journaling layer for block devices.  It is
 +        This is a generic journalling layer for block devices.  It is
          currently used by the ext3 and OCFS2 file systems, but it could
          also be used to add journal support to other file systems or block
          devices such as RAID or LVM.
@@@ -239,50 -170,18 +239,50 @@@ config JBD_DEBU
          generated.  To turn debugging off again, do
          "echo 0 > /proc/sys/fs/jbd-debug".
  
 +config JBD2
 +      tristate
 +      help
 +        This is a generic journaling layer for block devices that support
 +        both 32-bit and 64-bit block numbers.  It is currently used by
 +        the ext4dev/ext4 filesystem, but it could also be used to add
 +        journal support to other file systems or block devices such
 +        as RAID or LVM.
 +
 +        If you are using ext4dev/ext4, you need to say Y here. If you are not
 +        using ext4dev/ext4 then you will probably want to say N.
 +
 +        To compile this device as a module, choose M here. The module will be
 +        called jbd2.  If you are compiling ext4dev/ext4 into the kernel,
 +        you cannot compile this code as a module.
 +
 +config JBD2_DEBUG
 +      bool "JBD2 (ext4dev/ext4) debugging support"
 +      depends on JBD2
 +      help
 +        If you are using the ext4dev/ext4 journaled file system (or
 +        potentially any other filesystem/device using JBD2), this option
 +        allows you to enable debugging output while the system is running,
 +        in order to help track down any problems you are having.
 +        By default, the debugging output will be turned off.
 +
 +        If you select Y here, then you will be able to turn on debugging
 +        with "echo N > /proc/sys/fs/jbd2-debug", where N is a number between
 +        1 and 5. The higher the number, the more debugging output is
 +        generated.  To turn debugging off again, do
 +        "echo 0 > /proc/sys/fs/jbd2-debug".
 +
  config FS_MBCACHE
 -# Meta block cache for Extended Attributes (ext2/ext3)
 +# Meta block cache for Extended Attributes (ext2/ext3/ext4)
        tristate
 -      depends on EXT2_FS_XATTR || EXT3_FS_XATTR
 -      default y if EXT2_FS=y || EXT3_FS=y
 -      default m if EXT2_FS=m || EXT3_FS=m
 +      depends on EXT2_FS_XATTR || EXT3_FS_XATTR || EXT4DEV_FS_XATTR
 +      default y if EXT2_FS=y || EXT3_FS=y || EXT4DEV_FS=y
 +      default m if EXT2_FS=m || EXT3_FS=m || EXT4DEV_FS=m
  
  config REISERFS_FS
        tristate "Reiserfs support"
        help
          Stores not just filenames but the files themselves in a balanced
 -        tree.  Uses journaling.
 +        tree.  Uses journalling.
  
          Balanced trees are more efficient than traditional file system
          architectural foundations.
@@@ -424,7 -323,6 +424,7 @@@ config FS_POSIX_AC
        default n
  
  source "fs/xfs/Kconfig"
 +source "fs/gfs2/Kconfig"
  
  config OCFS2_FS
        tristate "OCFS2 file system support"
@@@ -501,8 -399,6 +501,8 @@@ config ROMFS_F
          If you don't know whether you need it, then you don't need it:
          answer N.
  
 +endif
 +
  config INOTIFY
        bool "Inotify file change notification support"
        default y
@@@ -634,7 -530,6 +634,7 @@@ config FUSE_F
          If you want to develop a userspace FS, or if you want to use
          a filesystem based on FUSE, answer Y or M.
  
 +if BLOCK
  menu "CD-ROM/DVD Filesystems"
  
  config ISO9660_FS
@@@ -702,9 -597,7 +702,9 @@@ config UDF_NL
        depends on (UDF_FS=m && NLS) || (UDF_FS=y && NLS=y)
  
  endmenu
 +endif
  
 +if BLOCK
  menu "DOS/FAT/NT Filesystems"
  
  config FAT_FS
@@@ -889,7 -782,6 +889,7 @@@ config NTFS_R
          It is perfectly safe to say N here.
  
  endmenu
 +endif
  
  menu "Pseudo filesystems"
  
@@@ -934,25 -826,6 +934,25 @@@ config PROC_VMCOR
          help
          Exports the dump image of crashed kernel in ELF format.
  
 +config PROC_SYSCTL
 +      bool "Sysctl support (/proc/sys)" if EMBEDDED
 +      depends on PROC_FS
 +      select SYSCTL
 +      default y
 +      ---help---
 +        The sysctl interface provides a means of dynamically changing
 +        certain kernel parameters and variables on the fly without requiring
 +        a recompile of the kernel or reboot of the system.  The primary
 +        interface is through /proc/sys.  If you say Y here a tree of
 +        modifiable sysctl entries will be generated beneath the
 +          /proc/sys directory. They are explained in the files
 +        in <file:Documentation/sysctl/>.  Note that enabling this
 +        option will enlarge the kernel by at least 8 KB.
 +
 +        As it is generally a good thing, you should say Y here unless
 +        building a kernel for install/rescue disks or your system is very
 +        limited in memory.
 +
  config SYSFS
        bool "sysfs file system support" if EMBEDDED
        default y
@@@ -989,19 -862,6 +989,19 @@@ config TMPF
  
          See <file:Documentation/filesystems/tmpfs.txt> for details.
  
 +config TMPFS_POSIX_ACL
 +      bool "Tmpfs POSIX Access Control Lists"
 +      depends on TMPFS
 +      select GENERIC_ACL
 +      help
 +        POSIX Access Control Lists (ACLs) support permissions for users and
 +        groups beyond the owner/group/world scheme.
 +
 +        To learn more about Access Control Lists, visit the POSIX ACLs for
 +        Linux website <http://acl.bestbits.at/>.
 +
 +        If you don't know what Access Control Lists are, say N.
 +
  config HUGETLBFS
        bool "HugeTLB file system support"
        depends X86 || IA64 || PPC64 || SPARC64 || SUPERH || BROKEN
@@@ -1047,7 -907,7 +1047,7 @@@ menu "Miscellaneous filesystems
  
  config ADFS_FS
        tristate "ADFS file system support (EXPERIMENTAL)"
 -      depends on EXPERIMENTAL
 +      depends on BLOCK && EXPERIMENTAL
        help
          The Acorn Disc Filing System is the standard file system of the
          RiscOS operating system which runs on Acorn's ARM-based Risc PC
@@@ -1075,7 -935,7 +1075,7 @@@ config ADFS_FS_R
  
  config AFFS_FS
        tristate "Amiga FFS file system support (EXPERIMENTAL)"
 -      depends on EXPERIMENTAL
 +      depends on BLOCK && EXPERIMENTAL
        help
          The Fast File System (FFS) is the common file system used on hard
          disks by Amiga(tm) systems since AmigaOS Version 1.3 (34.20).  Say Y
          To compile this file system support as a module, choose M here: the
          module will be called affs.  If unsure, say N.
  
 +config ECRYPT_FS
 +      tristate "eCrypt filesystem layer support (EXPERIMENTAL)"
 +      depends on EXPERIMENTAL && KEYS && CRYPTO
 +      help
 +        Encrypted filesystem that operates on the VFS layer.  See
 +        <file:Documentation/ecryptfs.txt> to learn more about
 +        eCryptfs.  Userspace components are required and can be
 +        obtained from <http://ecryptfs.sf.net>.
 +
 +        To compile this file system support as a module, choose M here: the
 +        module will be called ecryptfs.
 +
  config HFS_FS
        tristate "Apple Macintosh file system support (EXPERIMENTAL)"
 -      depends on EXPERIMENTAL
 +      depends on BLOCK && EXPERIMENTAL
        select NLS
        help
          If you say Y here, you will be able to mount Macintosh-formatted
  
  config HFSPLUS_FS
        tristate "Apple Extended HFS file system support"
 +      depends on BLOCK
        select NLS
        select NLS_UTF8
        help
  
  config BEFS_FS
        tristate "BeOS file system (BeFS) support (read only) (EXPERIMENTAL)"
 -      depends on EXPERIMENTAL
 +      depends on BLOCK && EXPERIMENTAL
        select NLS
        help
          The BeOS File System (BeFS) is the native file system of Be, Inc's
          on files and directories, and database-like indeces on selected
          attributes. (Also note that this driver doesn't make those features
          available at this time). It is a 64 bit filesystem, so it supports
 -        extremly large volumes and files.
 +        extremely large volumes and files.
  
          If you use this filesystem, you should also say Y to at least one
          of the NLS (native language support) options below.
@@@ -1163,7 -1010,7 +1163,7 @@@ config BEFS_DEBU
  
  config BFS_FS
        tristate "BFS file system support (EXPERIMENTAL)"
 -      depends on EXPERIMENTAL
 +      depends on BLOCK && EXPERIMENTAL
        help
          Boot File System (BFS) is a file system used under SCO UnixWare to
          allow the bootloader access to the kernel image and other important
  
  config EFS_FS
        tristate "EFS file system support (read only) (EXPERIMENTAL)"
 -      depends on EXPERIMENTAL
 +      depends on BLOCK && EXPERIMENTAL
        help
          EFS is an older file system used for non-ISO9660 CD-ROMs and hard
          disk partitions by SGI's IRIX operating system (IRIX 6.0 and newer
  
  config JFFS_FS
        tristate "Journalling Flash File System (JFFS) support"
 -      depends on MTD
 +      depends on MTD && BLOCK
        help
 -        JFFS is the Journaling Flash File System developed by Axis
 +        JFFS is the Journalling Flash File System developed by Axis
          Communications in Sweden, aimed at providing a crash/powerdown-safe
          file system for disk-less embedded devices. Further information is
          available at (<http://developer.axis.com/software/jffs/>).
@@@ -1372,7 -1219,7 +1372,7 @@@ config JFFS2_CMODE_NON
  config JFFS2_CMODE_PRIORITY
          bool "priority"
          help
 -          Tries the compressors in a predefinied order and chooses the first
 +          Tries the compressors in a predefined order and chooses the first
            successful one.
  
  config JFFS2_CMODE_SIZE
@@@ -1385,7 -1232,6 +1385,7 @@@ endchoic
  
  config CRAMFS
        tristate "Compressed ROM file system support (cramfs)"
 +      depends on BLOCK
        select ZLIB_INFLATE
        help
          Saying Y here includes support for CramFs (Compressed ROM File
  
  config VXFS_FS
        tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)"
 +      depends on BLOCK
        help
          FreeVxFS is a file system driver that support the VERITAS VxFS(TM)
          file system format.  VERITAS VxFS(TM) is the standard file system
  
  config HPFS_FS
        tristate "OS/2 HPFS file system support"
 +      depends on BLOCK
        help
          OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS
          is the file system used for organizing files on OS/2 hard disk
  
  config QNX4FS_FS
        tristate "QNX4 file system support (read only)"
 +      depends on BLOCK
        help
          This is the file system used by the real-time operating systems
          QNX 4 and QNX 6 (the latter is also called QNX RTP).
@@@ -1468,7 -1311,6 +1468,7 @@@ config QNX4FS_R
  
  config SYSV_FS
        tristate "System V/Xenix/V7/Coherent file system support"
 +      depends on BLOCK
        help
          SCO, Xenix and Coherent are commercial Unix systems for Intel
          machines, and Version 7 was used on the DEC PDP-11. Saying Y
  
          If you have floppies or hard disk partitions like that, it is likely
          that they contain binaries from those other Unix systems; in order
 -        to run these binaries, you will want to install linux-abi which is a
 +        to run these binaries, you will want to install linux-abi which is
          a set of kernel modules that lets you run SCO, Xenix, Wyse,
          UnixWare, Dell Unix and System V programs under Linux.  It is
          available via FTP (user: ftp) from
  
  config UFS_FS
        tristate "UFS file system support (read only)"
 +      depends on BLOCK
        help
          BSD and derivate versions of Unix (such as SunOS, FreeBSD, NetBSD,
          OpenBSD and NeXTstep) use a file system called UFS. Some System V
@@@ -1630,8 -1471,8 +1630,8 @@@ config NFS_V
          If unsure, say N.
  
  config NFS_DIRECTIO
 -      bool "Allow direct I/O on NFS files (EXPERIMENTAL)"
 -      depends on NFS_FS && EXPERIMENTAL
 +      bool "Allow direct I/O on NFS files"
 +      depends on NFS_FS
        help
          This option enables applications to perform uncached I/O on files
          in NFS file systems using the O_DIRECT open() flag.  When O_DIRECT
@@@ -1986,7 -1827,7 +1986,7 @@@ config CIFS_EXPERIMENTA
  config CIFS_UPCALL
          bool "Kerberos/SPNEGO advanced session setup (EXPERIMENTAL)"
          depends on CIFS_EXPERIMENTAL
-         select CONNECTOR
+         depends on CONNECTOR
          help
            Enables an upcall mechanism for CIFS which will be used to contact
            userspace helper utilities to provide SPNEGO packaged Kerberos
@@@ -2062,7 -1903,7 +2062,7 @@@ config AFS_F
          If you say Y here, you will get an experimental Andrew File System
          driver. It currently only supports unsecured read-only AFS access.
  
 -        See <file:Documentation/filesystems/afs.txt> for more intormation.
 +        See <file:Documentation/filesystems/afs.txt> for more information.
  
          If unsure, say N.
  
@@@ -2080,22 -1921,15 +2080,22 @@@ config 9P_F
  
          If unsure, say N.
  
 +config GENERIC_ACL
 +      bool
 +      select FS_POSIX_ACL
 +
  endmenu
  
 +if BLOCK
  menu "Partition Types"
  
  source "fs/partitions/Kconfig"
  
  endmenu
 +endif
  
  source "fs/nls/Kconfig"
 +source "fs/dlm/Kconfig"
  
  endmenu
  
diff --combined fs/cifs/cifsfs.c
index c00c654f2e11c0ce9cdbb3d597bb1afe9e673ddb,43364361276e296d903cf781a282f1add66d1140..84976cdbe7136c4b76ad0777c924d44fd4b613cd
@@@ -63,6 -63,7 +63,7 @@@ extern struct task_struct * oplockThrea
  struct task_struct * oplockThread = NULL;
  extern struct task_struct * dnotifyThread; /* remove sparse warning */
  struct task_struct * dnotifyThread = NULL;
+ static struct super_operations cifs_super_ops; 
  unsigned int CIFSMaxBufSize = CIFS_MAX_MSGSIZE;
  module_param(CIFSMaxBufSize, int, 0);
  MODULE_PARM_DESC(CIFSMaxBufSize,"Network buffer size (not including header). Default: 16384 Range: 8192 to 130048");
@@@ -198,10 -199,12 +199,12 @@@ cifs_statfs(struct dentry *dentry, stru
      /* Only need to call the old QFSInfo if failed
      on newer one */
      if(rc)
-       rc = CIFSSMBQFSInfo(xid, pTcon, buf);
+       if(pTcon->ses->capabilities & CAP_NT_SMBS)
+               rc = CIFSSMBQFSInfo(xid, pTcon, buf); /* not supported by OS2 */
  
-       /* Old Windows servers do not support level 103, retry with level 
-          one if old server failed the previous call */ 
+       /* Some old Windows servers also do not support level 103, retry with
+          older level one if old server failed the previous call or we
+          bypassed it because we detected that this was an older LANMAN sess */
        if(rc)
                rc = SMBOldQFSInfo(xid, pTcon, buf);
        /*     
@@@ -253,6 -256,7 +256,6 @@@ cifs_alloc_inode(struct super_block *sb
        file data or metadata */
        cifs_inode->clientCanCacheRead = FALSE;
        cifs_inode->clientCanCacheAll = FALSE;
 -      cifs_inode->vfs_inode.i_blksize = CIFS_MAX_MSGSIZE;
        cifs_inode->vfs_inode.i_blkbits = 14;  /* 2**14 = CIFS_MAX_MSGSIZE */
        cifs_inode->vfs_inode.i_flags = S_NOATIME | S_NOCMTIME;
        INIT_LIST_HEAD(&cifs_inode->openFileList);
@@@ -435,13 -439,21 +438,21 @@@ static void cifs_umount_begin(struct vf
        return;
  }
  
+ #ifdef CONFIG_CIFS_STATS2
+ static int cifs_show_stats(struct seq_file *s, struct vfsmount *mnt)
+ {
+       /* BB FIXME */
+       return 0;
+ }
+ #endif
  static int cifs_remount(struct super_block *sb, int *flags, char *data)
  {
        *flags |= MS_NODIRATIME;
        return 0;
  }
  
- struct super_operations cifs_super_ops = {
+ static struct super_operations cifs_super_ops = {
        .read_inode = cifs_read_inode,
        .put_super = cifs_put_super,
        .statfs = cifs_statfs,
        .show_options = cifs_show_options,
        .umount_begin   = cifs_umount_begin,
        .remount_fs = cifs_remount,
+ #ifdef CONFIG_CIFS_STATS2
+       .show_stats = cifs_show_stats,
+ #endif
  };
  
  static int
@@@ -480,13 -495,25 +494,13 @@@ cifs_get_sb(struct file_system_type *fs
        return simple_set_mnt(mnt, sb);
  }
  
 -static ssize_t cifs_file_writev(struct file *file, const struct iovec *iov,
 -                              unsigned long nr_segs, loff_t *ppos)
 -{
 -      struct inode *inode = file->f_dentry->d_inode;
 -      ssize_t written;
 -
 -      written = generic_file_writev(file, iov, nr_segs, ppos);
 -      if (!CIFS_I(inode)->clientCanCacheAll)
 -              filemap_fdatawrite(inode->i_mapping);
 -      return written;
 -}
 -
 -static ssize_t cifs_file_aio_write(struct kiocb *iocb, const char __user *buf,
 -                                 size_t count, loff_t pos)
 +static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
 +                                 unsigned long nr_segs, loff_t pos)
  {
        struct inode *inode = iocb->ki_filp->f_dentry->d_inode;
        ssize_t written;
  
 -      written = generic_file_aio_write(iocb, buf, count, pos);
 +      written = generic_file_aio_write(iocb, iov, nr_segs, pos);
        if (!CIFS_I(inode)->clientCanCacheAll)
                filemap_fdatawrite(inode->i_mapping);
        return written;
  static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
  {
        /* origin == SEEK_END => we must revalidate the cached file length */
-       if (origin == 2) {
+       if (origin == SEEK_END) {
                int retval = cifs_revalidate(file->f_dentry);
                if (retval < 0)
                        return (loff_t)retval;
@@@ -565,6 -592,8 +579,6 @@@ struct inode_operations cifs_symlink_in
  const struct file_operations cifs_file_ops = {
        .read = do_sync_read,
        .write = do_sync_write,
 -      .readv = generic_file_readv,
 -      .writev = cifs_file_writev,
        .aio_read = generic_file_aio_read,
        .aio_write = cifs_file_aio_write,
        .open = cifs_open,
@@@ -606,6 -635,8 +620,6 @@@ const struct file_operations cifs_file_
  const struct file_operations cifs_file_nobrl_ops = {
        .read = do_sync_read,
        .write = do_sync_write,
 -      .readv = generic_file_readv,
 -      .writev = cifs_file_writev,
        .aio_read = generic_file_aio_read,
        .aio_write = cifs_file_aio_write,
        .open = cifs_open,
@@@ -682,7 -713,8 +696,7 @@@ cifs_init_inodecache(void
  static void
  cifs_destroy_inodecache(void)
  {
 -      if (kmem_cache_destroy(cifs_inode_cachep))
 -              printk(KERN_WARNING "cifs_inode_cache: error freeing\n");
 +      kmem_cache_destroy(cifs_inode_cachep);
  }
  
  static int
@@@ -760,9 -792,13 +774,9 @@@ static voi
  cifs_destroy_request_bufs(void)
  {
        mempool_destroy(cifs_req_poolp);
 -      if (kmem_cache_destroy(cifs_req_cachep))
 -              printk(KERN_WARNING
 -                     "cifs_destroy_request_cache: error not all structures were freed\n");
 +      kmem_cache_destroy(cifs_req_cachep);
        mempool_destroy(cifs_sm_req_poolp);
 -      if (kmem_cache_destroy(cifs_sm_req_cachep))
 -              printk(KERN_WARNING
 -                    "cifs_destroy_request_cache: cifs_small_rq free error\n");
 +      kmem_cache_destroy(cifs_sm_req_cachep);
  }
  
  static int
@@@ -797,8 -833,13 +811,8 @@@ static voi
  cifs_destroy_mids(void)
  {
        mempool_destroy(cifs_mid_poolp);
 -      if (kmem_cache_destroy(cifs_mid_cachep))
 -              printk(KERN_WARNING
 -                     "cifs_destroy_mids: error not all structures were freed\n");
 -
 -      if (kmem_cache_destroy(cifs_oplock_cachep))
 -              printk(KERN_WARNING
 -                     "error not all oplock structures were freed\n");
 +      kmem_cache_destroy(cifs_mid_cachep);
 +      kmem_cache_destroy(cifs_oplock_cachep);
  }
  
  static int cifs_oplock_thread(void * dummyarg)
@@@ -903,7 -944,7 +917,7 @@@ init_cifs(void
  #ifdef CONFIG_PROC_FS
        cifs_proc_init();
  #endif
      INIT_LIST_HEAD(&GlobalServerList);      /* BB not implemented yet */
/*    INIT_LIST_HEAD(&GlobalServerList);*/    /* BB not implemented yet */
        INIT_LIST_HEAD(&GlobalSMBSessionList);
        INIT_LIST_HEAD(&GlobalTreeConnectionList);
        INIT_LIST_HEAD(&GlobalOplock_Q);
        GlobalCurrentXid = 0;
        GlobalTotalActiveXid = 0;
        GlobalMaxActiveXid = 0;
+       memset(Local_System_Name, 0, 15);
        rwlock_init(&GlobalSMBSeslock);
        spin_lock_init(&GlobalMid_Lock);
  
diff --combined fs/cifs/connect.c
index c78762051da4e5b15da45fa06b46b66d85e55d82,1d17691086c2d6a6024441d96d729948cec4ebe9..4093d53329306bfc74c0487e06c09d434d7043a6
@@@ -109,7 -109,7 +109,7 @@@ static int ipv6_connect(struct sockaddr
         * wake up waiters on reconnection? - (not needed currently)
         */
  
- int
static int
  cifs_reconnect(struct TCP_Server_Info *server)
  {
        int rc = 0;
@@@ -771,13 -771,17 +771,18 @@@ cifs_parse_mount_options(char *options
        separator[0] = ',';
        separator[1] = 0; 
  
-       memset(vol->source_rfc1001_name,0x20,15);
-       for(i=0;i < strnlen(utsname()->nodename,15);i++) {
-               /* does not have to be a perfect mapping since the field is
-               informational, only used for servers that do not support
-               port 445 and it can be overridden at mount time */
-               vol->source_rfc1001_name[i] = 
-                       toupper(utsname()->nodename[i]);
 -      if(Local_System_Name[0] != 0)
++      if (Local_System_Name[0] != 0)
+               memcpy(vol->source_rfc1001_name, Local_System_Name,15);
+       else {
++              char *nodename = utsname()->nodename;
++              int n = strnlen(nodename,15);
+               memset(vol->source_rfc1001_name,0x20,15);
 -              for(i=0;i < strnlen(system_utsname.nodename,15);i++) {
++              for(i=0 ; i < n ; i++) {
+                       /* does not have to be perfect mapping since field is
+                       informational, only used for servers that do not support
+                       port 445 and it can be overridden at mount time */
 -                      vol->source_rfc1001_name[i] = 
 -                              toupper(system_utsname.nodename[i]);
++                      vol->source_rfc1001_name[i] = toupper(nodename[i]);
+               }
        }
        vol->source_rfc1001_name[15] = 0;
        /* null target name indicates to use *SMBSERVR default called name
@@@ -2153,7 -2157,7 +2158,7 @@@ CIFSSessSetup(unsigned int xid, struct 
                                  32, nls_codepage);
                bcc_ptr += 2 * bytes_returned;
                bytes_returned =
 -                  cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release,
 +                  cifs_strtoUCS((__le16 *) bcc_ptr, utsname()->release,
                                  32, nls_codepage);
                bcc_ptr += 2 * bytes_returned;
                bcc_ptr += 2;
                }
                strcpy(bcc_ptr, "Linux version ");
                bcc_ptr += strlen("Linux version ");
 -              strcpy(bcc_ptr, system_utsname.release);
 -              bcc_ptr += strlen(system_utsname.release) + 1;
 +              strcpy(bcc_ptr, utsname()->release);
 +              bcc_ptr += strlen(utsname()->release) + 1;
                strcpy(bcc_ptr, CIFS_NETWORK_OPSYS);
                bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1;
        }
@@@ -2445,7 -2449,7 +2450,7 @@@ CIFSNTLMSSPNegotiateSessSetup(unsigned 
                                  32, nls_codepage);
                bcc_ptr += 2 * bytes_returned;
                bytes_returned =
 -                  cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, 32,
 +                  cifs_strtoUCS((__le16 *) bcc_ptr, utsname()->release, 32,
                                  nls_codepage);
                bcc_ptr += 2 * bytes_returned;
                bcc_ptr += 2;   /* null terminate Linux version */
        } else {                /* ASCII */
                strcpy(bcc_ptr, "Linux version ");
                bcc_ptr += strlen("Linux version ");
 -              strcpy(bcc_ptr, system_utsname.release);
 -              bcc_ptr += strlen(system_utsname.release) + 1;
 +              strcpy(bcc_ptr, utsname()->release);
 +              bcc_ptr += strlen(utsname()->release) + 1;
                strcpy(bcc_ptr, CIFS_NETWORK_OPSYS);
                bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1;
                bcc_ptr++;      /* empty domain field */
@@@ -2836,7 -2840,7 +2841,7 @@@ CIFSNTLMSSPAuthSessSetup(unsigned int x
                                  32, nls_codepage);
                bcc_ptr += 2 * bytes_returned;
                bytes_returned =
 -                  cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, 32,
 +                  cifs_strtoUCS((__le16 *) bcc_ptr, utsname()->release, 32,
                                  nls_codepage);
                bcc_ptr += 2 * bytes_returned;
                bcc_ptr += 2;   /* null term version string */
  
                strcpy(bcc_ptr, "Linux version ");
                bcc_ptr += strlen("Linux version ");
 -              strcpy(bcc_ptr, system_utsname.release);
 -              bcc_ptr += strlen(system_utsname.release) + 1;
 +              strcpy(bcc_ptr, utsname()->release);
 +              bcc_ptr += strlen(utsname()->release) + 1;
                strcpy(bcc_ptr, CIFS_NETWORK_OPSYS);
                bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1;
                bcc_ptr++;      /* null domain */
@@@ -3215,7 -3219,9 +3220,9 @@@ CIFSTCon(unsigned int xid, struct cifsS
                        }
                        /* else do not bother copying these informational fields */
                }
-               if(smb_buffer_response->WordCount == 3)
+               if((smb_buffer_response->WordCount == 3) ||
+                        (smb_buffer_response->WordCount == 7))
+                       /* field is in same location */
                        tcon->Flags = le16_to_cpu(pSMBr->OptionalSupport);
                else
                        tcon->Flags = 0;
@@@ -3312,19 -3318,21 +3319,21 @@@ int cifs_setup_session(unsigned int xid
                first_time = 1;
        }
        if (!rc) {
+               pSesInfo->flags = 0;
                pSesInfo->capabilities = pSesInfo->server->capabilities;
                if(linuxExtEnabled == 0)
                        pSesInfo->capabilities &= (~CAP_UNIX);
        /*      pSesInfo->sequence_number = 0;*/
-               cFYI(1,("Security Mode: 0x%x Capabilities: 0x%x Time Zone: %d",
+               cFYI(1,("Security Mode: 0x%x Capabilities: 0x%x TimeAdjust: %d",
                        pSesInfo->server->secMode,
                        pSesInfo->server->capabilities,
-                       pSesInfo->server->timeZone));
+                       pSesInfo->server->timeAdj));
                if(experimEnabled < 2)
                        rc = CIFS_SessSetup(xid, pSesInfo,
                                            first_time, nls_info);
                else if (extended_security
-                               && (pSesInfo->capabilities & CAP_EXTENDED_SECURITY)
+                               && (pSesInfo->capabilities 
+                                       & CAP_EXTENDED_SECURITY)
                                && (pSesInfo->server->secType == NTLMSSP)) {
                        rc = -EOPNOTSUPP;
                } else if (extended_security
                        if (!rc) {
                                if(ntlmv2_flag) {
                                        char * v2_response;
-                                       cFYI(1,("Can use more secure NTLM version 2 password hash"));
+                                       cFYI(1,("more secure NTLM ver2 hash"));
                                        if(CalcNTLMv2_partial_mac_key(pSesInfo, 
                                                nls_info)) {
                                                rc = -ENOMEM;
diff --combined fs/cifs/inode.c
index 6b90ef98e4cfe9cdfcd224bdb0a2df202b66612f,fe6d21f99964428ce9a55a1c768d8a60b68197f5..35d54bb0869ab67510449f4a412aa0018c9fcfc8
@@@ -19,6 -19,7 +19,6 @@@
   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
   */
  #include <linux/fs.h>
 -#include <linux/buffer_head.h>
  #include <linux/stat.h>
  #include <linux/pagemap.h>
  #include <asm/div64.h>
@@@ -337,6 -338,7 +337,7 @@@ int cifs_get_inode_info(struct inode **
                pfindData = (FILE_ALL_INFO *)buf;
                /* could do find first instead but this returns more info */
                rc = CIFSSMBQPathInfo(xid, pTcon, search_path, pfindData,
+                             0 /* not legacy */,
                              cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
                                CIFS_MOUNT_MAP_SPECIAL_CHR);
                /* BB optimize code so we do not make the above call
                /* get new inode */
                if (*pinode == NULL) {
                        *pinode = new_inode(sb);
-                       if (*pinode == NULL)
+                       if (*pinode == NULL) {
+                               kfree(buf);
                                return -ENOMEM;
+                       }
                        /* Is an i_ino of zero legal? Can we use that to check
                           if the server supports returning inode numbers?  Are
                           there other sanity checks we can use to ensure that
                (pTcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFE00;*/
  
                /* Linux can not store file creation time so ignore it */
-               inode->i_atime =
-                   cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastAccessTime));
+               if(pfindData->LastAccessTime)
+                       inode->i_atime = cifs_NTtimeToUnix
+                               (le64_to_cpu(pfindData->LastAccessTime));
+               else /* do not need to use current_fs_time - time not stored */
+                       inode->i_atime = CURRENT_TIME;
                inode->i_mtime =
                    cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastWriteTime));
                inode->i_ctime =
@@@ -590,7 -597,7 +596,7 @@@ int cifs_unlink(struct inode *inode, st
  
        if (!rc) {
                if (direntry->d_inode)
 -                      direntry->d_inode->i_nlink--;
 +                      drop_nlink(direntry->d_inode);
        } else if (rc == -ENOENT) {
                d_drop(direntry);
        } else if (rc == -ETXTBSY) {
                                                CIFS_MOUNT_MAP_SPECIAL_CHR);
                        CIFSSMBClose(xid, pTcon, netfid);
                        if (direntry->d_inode)
 -                              direntry->d_inode->i_nlink--;
 +                              drop_nlink(direntry->d_inode);
                }
        } else if (rc == -EACCES) {
                /* try only if r/o attribute set in local lookup data? */
                                                CIFS_MOUNT_MAP_SPECIAL_CHR);
                        if (!rc) {
                                if (direntry->d_inode)
 -                                      direntry->d_inode->i_nlink--;
 +                                      drop_nlink(direntry->d_inode);
                        } else if (rc == -ETXTBSY) {
                                int oplock = FALSE;
                                __u16 netfid;
                                                    CIFS_MOUNT_MAP_SPECIAL_CHR);
                                        CIFSSMBClose(xid, pTcon, netfid);
                                        if (direntry->d_inode)
 -                                              direntry->d_inode->i_nlink--;
 +                                              drop_nlink(direntry->d_inode);
                                }
                        /* BB if rc = -ETXTBUSY goto the rename logic BB */
                        }
@@@ -735,7 -742,7 +741,7 @@@ int cifs_mkdir(struct inode *inode, str
                cFYI(1, ("cifs_mkdir returned 0x%x", rc));
                d_drop(direntry);
        } else {
 -              inode->i_nlink++;
 +              inc_nlink(inode);
                if (pTcon->ses->capabilities & CAP_UNIX)
                        rc = cifs_get_inode_info_unix(&newinode, full_path,
                                                      inode->i_sb,xid);
@@@ -816,9 -823,9 +822,9 @@@ int cifs_rmdir(struct inode *inode, str
                          cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
  
        if (!rc) {
 -              inode->i_nlink--;
 +              drop_nlink(inode);
                i_size_write(direntry->d_inode,0);
 -              direntry->d_inode->i_nlink = 0;
 +              clear_nlink(direntry->d_inode);
        }
  
        cifsInode = CIFS_I(direntry->d_inode);
diff --combined fs/cifs/readdir.c
index b27b34537bf23c2bf3bbc566c1155c3d331df7a1,acbabc09543fe596f585dd69e6ff8a518d5d56cd..b5b0a2a41befe85734ffc30dc47f68f76bf05790
@@@ -106,6 -106,17 +106,17 @@@ static int construct_dentry(struct qst
        return rc;
  }
  
+ static void AdjustForTZ(struct cifsTconInfo * tcon, struct inode * inode)
+ {
+       if((tcon) && (tcon->ses) && (tcon->ses->server)) {
+               inode->i_ctime.tv_sec += tcon->ses->server->timeAdj;
+               inode->i_mtime.tv_sec += tcon->ses->server->timeAdj;
+               inode->i_atime.tv_sec += tcon->ses->server->timeAdj;
+       }
+       return;
+ }
  static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
                char * buf, int *pobject_type, int isNewInode)
  {
                tmp_inode->i_ctime =
                      cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime));
        } else { /* legacy, OS2 and DOS style */
+ /*            struct timespec ts;*/
                FIND_FILE_STANDARD_INFO * pfindData = 
                        (FIND_FILE_STANDARD_INFO *)buf;
  
+               tmp_inode->i_mtime = cnvrtDosUnixTm(
+                               le16_to_cpu(pfindData->LastWriteDate),
+                               le16_to_cpu(pfindData->LastWriteTime));
+               tmp_inode->i_atime = cnvrtDosUnixTm(
+                               le16_to_cpu(pfindData->LastAccessDate),
+                               le16_to_cpu(pfindData->LastAccessTime));
+                 tmp_inode->i_ctime = cnvrtDosUnixTm(
+                                 le16_to_cpu(pfindData->LastWriteDate),
+                                 le16_to_cpu(pfindData->LastWriteTime));
+               AdjustForTZ(cifs_sb->tcon, tmp_inode);
                attr = le16_to_cpu(pfindData->Attributes);
                allocation_size = le32_to_cpu(pfindData->AllocationSize);
                end_of_file = le32_to_cpu(pfindData->DataSize);
-               tmp_inode->i_atime = CURRENT_TIME;
-               /* tmp_inode->i_mtime =  BB FIXME - add dos time handling
-               tmp_inode->i_ctime = 0;   BB FIXME */
        }
  
        /* Linux can not store file creation time unfortunately so ignore it */
  
        if (allocation_size < end_of_file)
                cFYI(1, ("May be sparse file, allocation less than file size"));
 -      cFYI(1, ("File Size %ld and blocks %llu and blocksize %ld",
 +      cFYI(1, ("File Size %ld and blocks %llu",
                (unsigned long)tmp_inode->i_size,
 -              (unsigned long long)tmp_inode->i_blocks,
 -              tmp_inode->i_blksize));
 +              (unsigned long long)tmp_inode->i_blocks));
        if (S_ISREG(tmp_inode->i_mode)) {
                cFYI(1, ("File inode"));
                tmp_inode->i_op = &cifs_file_inode_ops;
@@@ -938,6 -957,7 +956,7 @@@ static int cifs_save_resume_key(const c
                filename = &pFindData->FileName[0];
                /* one byte length, no name conversion */
                len = (unsigned int)pFindData->FileNameLength;
+               cifsFile->srch_inf.resume_key = pFindData->ResumeKey;
        } else {
                cFYI(1,("Unknown findfirst level %d",level));
                return -EINVAL;
diff --combined fs/cifs/sess.c
index 22b4c35dcfe3e4bfbc067b56880f5fb958df50ae,e4c4e466e3206bfbca8ee4c1444deaa2a08880c3..a8a083543ba050fa65cceee9a302c9b733f68311
@@@ -111,7 -111,7 +111,7 @@@ static void unicode_ssetup_strings(cha
        bytes_ret = cifs_strtoUCS((__le16 *)bcc_ptr, "Linux version ", 32,
                                  nls_cp);
        bcc_ptr += 2 * bytes_ret;
 -      bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release,
 +      bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, init_utsname()->release,
                                  32, nls_cp);
        bcc_ptr += 2 * bytes_ret;
        bcc_ptr += 2; /* trailing null */
@@@ -158,8 -158,8 +158,8 @@@ static void ascii_ssetup_strings(char *
  
        strcpy(bcc_ptr, "Linux version ");
        bcc_ptr += strlen("Linux version ");
 -      strcpy(bcc_ptr, system_utsname.release);
 -      bcc_ptr += strlen(system_utsname.release) + 1;
 +      strcpy(bcc_ptr, init_utsname()->release);
 +      bcc_ptr += strlen(init_utsname()->release) + 1;
  
        strcpy(bcc_ptr, CIFS_NETWORK_OPSYS);
        bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1;
@@@ -268,6 -268,10 +268,10 @@@ static int decode_ascii_ssetup(char ** 
        ses->serverOS = kzalloc(len + 1, GFP_KERNEL);
        if(ses->serverOS)
                strncpy(ses->serverOS, bcc_ptr, len);
+       if(strncmp(ses->serverOS, "OS/2",4) == 0) {
+                       cFYI(1,("OS/2 server"));
+                       ses->flags |= CIFS_SES_OS2;
+       }
  
        bcc_ptr += len + 1;
        bleft -= len + 1;
          if(len > bleft)
                  return rc;
  
-         if(ses->serverDomain)
-                 kfree(ses->serverDomain);
-         ses->serverDomain = kzalloc(len + 1, GFP_KERNEL);
-         if(ses->serverOS)
-                 strncpy(ses->serverOS, bcc_ptr, len);
-         bcc_ptr += len + 1;
-       bleft -= len + 1;
+       /* No domain field in LANMAN case. Domain is
+          returned by old servers in the SMB negprot response */
+       /* BB For newer servers which do not support Unicode,
+          but thus do return domain here we could add parsing
+          for it later, but it is not very important */
        cFYI(1,("ascii: bytes left %d",bleft));
  
        return rc;
@@@ -366,6 -365,8 +365,8 @@@ CIFS_SessSetup(unsigned int xid, struc
        str_area = kmalloc(2000, GFP_KERNEL);
        bcc_ptr = str_area;
  
+       ses->flags &= ~CIFS_SES_LANMAN;
        if(type == LANMAN) {
  #ifdef CONFIG_CIFS_WEAK_PW_HASH
                char lnm_session_key[CIFS_SESS_KEY_SIZE];
                /* and copy into bcc */
  
                calc_lanman_hash(ses, lnm_session_key);
+               ses->flags |= CIFS_SES_LANMAN; 
  /* #ifdef CONFIG_CIFS_DEBUG2
                cifs_dump_mem("cryptkey: ",ses->server->cryptKey,
                        CIFS_SESS_KEY_SIZE);