12 Oct, 2008

1 commit


09 Oct, 2008

1 commit


08 Oct, 2008

2 commits

  • When we do a seekdir() or equivalent, we usually end up doing a
    FindFirst call and then call FindNext until we get to the offset that we
    want. The problem is that when we call FindNext, the code usually
    doesn't have the proper info (mostly, the filename of the entry from the
    last search) to resume the search.

    Add a "last_entry" field to the cifs_search_info that points to the last
    entry in the search. We calculate this pointer by using the
    LastNameOffset field from the search parms that are returned. We then
    use that info to do a cifs_save_resume_key before we call CIFSFindNext.

    This patch allows CIFS to reliably pass the "telldir" connectathon test.

    Signed-off-by: Jeff Layton
    CC: Stable
    Signed-off-by: Steve French

    Steve French
     
  • Currently, if a standard delete fails and we end up getting -EACCES
    we try to clear ATTR_READONLY and try the delete again. If that
    then fails with -ETXTBSY then we try a rename_pending_delete. We
    aren't handling other errors appropriately though.

    Another client could have deleted the file in the meantime and
    we get back -ENOENT, for instance. In that case we wouldn't do a
    d_drop. Instead of retrying in a separate call, simply goto the
    original call and use the error handling from that.

    Also, we weren't properly undoing any attribute changes that
    were done before returning an error back to the caller.

    CC: Jeff Layton
    Signed-off-by: Steve French

    Steve French
     

07 Oct, 2008

1 commit


25 Sep, 2008

6 commits

  • cifs: explicitly revoke SPNEGO key after session setup

    The SPNEGO blob returned by an upcall can only be used once. Explicitly
    revoke it to make sure that we never pick it up again after session
    setup exits.

    This doesn't seem to be that big an issue on more recent kernels, but
    older kernels seem to link keys into the session keyring by default.
    That said, explicitly revoking the key seems like a reasonable thing
    to do here.

    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • cifs: Convert cifs to new aops.

    This patch is based on the one originally posted by Nick Piggin. His
    patch was very close, but had a couple of small bugs. Nick's original
    comments follow:

    This is another relatively naive conversion. Always do the read upfront
    when the page is not uptodate (unless we're in the writethrough path).

    Fix an uninitialized data exposure where SetPageUptodate was called
    before the page was uptodate.

    SetPageUptodate and switch to writeback mode in the case that the full
    page was dirtied.

    Acked-by: Shaggy
    Acked-by: Badari Pulavarty
    Signed-off-by: Nick Piggin
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Nick Piggin
     
  • Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Steve French
     
  • cifs: remove NULL termination from rename target in CIFSSMBRenameOpenFIle

    The rename destination isn't supposed to be null terminated. Also,
    change the name string arg to be const.

    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • cifs: work around samba returning -ENOENT on SetFileDisposition call

    Samba seems to return STATUS_OBJECT_NAME_NOT_FOUND when we try to set
    the delete on close bit after doing a rename by filehandle. This looks
    like a samba bug to me, but a lot of servers will do this. For now,
    pretend an -ENOENT return is a success.

    Samba does however seem to respect the CREATE_DELETE_ON_CLOSE bit
    when opening files that already exist. Windows will ignore it, but
    so adding it to the open flags should be harmless.

    We're also currently ignoring the return code on the rename by
    filehandle, so no need to set rc based on it.

    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • cifs: fix inverted NULL check after kmalloc

    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

24 Sep, 2008

5 commits

  • We're given the datalen in the downcall, so there's no need to do any
    calls to strlen(). Just keep track of the datalen in the key. Finally,
    add a sanity check of the data in the downcall to make sure that it
    looks like a real IP address.

    Signed-off-by: Jeff Layton
    Acked-by: David Howells
    Signed-off-by: Steve French

    Steve French
     
  • Break out the code that does the actual renaming into a separate
    function and have cifs_rename call that. That function will attempt a
    path based rename first and then do a filehandle based one if it looks
    like the source is busy.

    The existing logic tried a path based rename first, but if we needed to
    remove the destination then it only attempted a filehandle based rename
    afterward. Not all servers support renaming by filehandle, so we need to
    always attempt path rename first and fall back to filehandle rename if
    it doesn't work.

    This also fixes renames of open files on windows servers (at least when
    the source and destination directories are the same).

    CC: Jeff Layton
    Signed-off-by: Steve French

    Steve French
     
  • cifs: add function to set file disposition

    The proper way to set the delete on close bit on an already existing
    file is to use SET_FILE_INFO with an infolevel of
    SMB_FILE_DISPOSITION_INFO. Add a function to do that and have the
    silly-rename code use it.

    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Steve French
     
  • cifs: move rename and delete-on-close logic into helper function

    When a file is still open on the server, we attempt to set the
    DELETE_ON_CLOSE bit and rename it to a new filename. When the
    last opener closes the file, the server should delete it.

    This patch moves this mechanism into a helper function and has
    the two places in cifs_unlink that do this procedure call it. It
    also fixes the open flags to be correct.

    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

23 Sep, 2008

2 commits

  • When the CIFS client goes to write out pages, it needs to pick a
    filehandle to write to. find_writeable_file however just picks the
    first filehandle that it finds. This can cause problems when a lock
    is issued against a particular filehandle and we pick a different
    filehandle to write to.

    This patch tries to avert this situation by having find_writable_file
    prefer filehandles that have a pid that matches the current task.
    This seems to fix lock test 11 from the connectathon test suite when
    run against a windows server.

    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • GFP_KERNEL and GFP_NOFS are mutually exclusive. If you combine them, you end up
    with plain GFP_KERNEL which can deadlock in cases where you really want
    GFP_NOFS.

    Cc: Steve French
    Signed-off-by: Pekka Enberg
    Signed-off-by: Steve French

    Pekka Enberg
     

17 Sep, 2008

2 commits

  • We already have a cifs_set_file_info function that can flip DOS
    attribute bits. Have cifs_unlink call it to handle turning ATTR_HIDDEN
    on and ATTR_READONLY off when an unlink attempt returns -EACCES.

    This also removes a level of indentation from cifs_unlink.

    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Steve French
     
  • Change parameters to cifs_unlink to match the ones used in the generic
    VFS. Add some local variables to cut down on the amount of struct
    dereferencing that needs to be done, and eliminate some unneeded NULL
    pointer checks on the parent directory inode. Finally, rename pTcon
    to "tcon" to more closely match standard kernel coding style.

    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

28 Aug, 2008

5 commits

  • LANMAN session setup did not support Unicode (after session setup, unicode can
    still be used though).

    Fixes samba bug# 5319

    CC: Jeff Layton
    CC: Stable Kernel
    Signed-off-by: Steve French

    Steve French
     
  • Signed-off-by: Steve French

    Steve French
     
  • The direct I/O write codepath for CIFS is done through
    cifs_user_write(). That function does not currently call
    generic_write_checks() so the file position isn't being properly set
    when the file is opened with O_APPEND. It's also not doing the other
    "normal" checks that should be done for a write call.

    The problem is currently that when you open a file with O_APPEND on a
    mount with the directio mount option, the file position is set to the
    beginning of the file. This makes any subsequent writes clobber the data
    in the file starting at the beginning.

    This seems to fix the problem in cursory testing. It is, however
    important to note that NFS disallows the combination of
    (O_DIRECT|O_APPEND). If my understanding is correct, the concern is
    races with multiple clients appending to a file clobbering each others'
    data. Since the write model for CIFS and NFS is pretty similar in this
    regard, CIFS is probably subject to the same sort of races. What's
    unclear to me is why this is a particular problem with O_DIRECT and not
    with buffered writes...

    Regardless, disallowing O_APPEND on an entire mount is probably not
    reasonable, so we'll probably just have to deal with it and reevaluate
    this flag combination when we get proper support for O_DIRECT. In the
    meantime this patch at least fixes the existing problem.

    Signed-off-by: Jeff Layton
    Cc: Stable Tree
    Signed-off-by: Steve French

    Jeff Layton
     
  • The last eight bytes of the password field were not cleared when doing lanman plaintext password authentication. This patch fixes that.

    I tested it with Samba by setting password
    encryption to no in the server's smb.conf. Other servers also can be
    configured to force plaintext authentication. Note that plaintexti
    authentication requires setting /proc/fs/cifs/SecurityFlags to 0x30030
    on the client (enabling both LANMAN and also plaintext password support).
    Also note that LANMAN support (and thus plaintext password support) requires
    CONFIG_CIFS_WEAK_PW_HASH to be enabled in menuconfig.

    CC: Jeff Layton
    CC: Stable Kernel
    Signed-off-by: Steve French

    Steve French
     
  • Otherwise, we're leaking the payload memory.

    CC: Stable Kernel
    Acked-by: David Howells
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

26 Aug, 2008

1 commit


20 Aug, 2008

3 commits


19 Aug, 2008

1 commit


14 Aug, 2008

1 commit

  • In looking at network named pipe support on cifs, I noticed that
    Dave Howell's iget patch:

    iget: stop CIFS from using iget() and read_inode()

    broke mounts to IPC$ (the interprocess communication share), and don't
    handle the error case (when getting info on the root inode fails).

    Thanks to Gunter who noted a typo in a debug line in the original
    version of this patch.

    CC: David Howells
    CC: Gunter Kukkukk
    CC: Stable Kernel
    Signed-off-by: Steve French

    Steve French
     

12 Aug, 2008

2 commits


09 Aug, 2008

2 commits

  • * 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
    [CIFS] list entry can not return null
    turn cifs_setattr into a multiplexor that calls the correct function
    move file time and dos attribute setting logic into new function
    spin off cifs_setattr with unix extensions to its own function
    [CIFS] Code cleanup in old sessionsetup code
    [CIFS] cifs_mkdir and cifs_create should respect the setgid bit on parent dir
    Rename CIFSSMBSetFileTimes to CIFSSMBSetFileInfo and add PID arg
    change CIFSSMBSetTimes to CIFSSMBSetPathInfo
    [CIFS] fix trailing whitespace
    bundle up Unix SET_PATH_INFO args into a struct and change name
    Fix missing braces in cifs_revalidate()
    remove locking around tcpSesAllocCount atomic variable
    [CIFS] properly account for new user= field in SPNEGO upcall string allocation
    [CIFS] remove level of indentation from decode_negTokenInit
    [CIFS] cifs send2 not retrying enough in some cases on full socket
    [CIFS] oid should also be checked against class in cifs asn

    Linus Torvalds
     
  • Signed-off-by: Steve French

    Steve French
     

07 Aug, 2008

3 commits


06 Aug, 2008

2 commits

  • Remove some long lines

    Signed-off-by: Steve French

    Steve French
     
  • If a server supports unix extensions but does not support POSIX create
    routines, then the client will create a new inode with a standard SMB
    mkdir or create/open call and then will set the mode. When it does this,
    it does not take the setgid bit on the parent directory into account.

    This patch has CIFS flip on the setgid bit when the parent directory has
    it. If the share is mounted with "setuids" then also change the group
    owner to the gid of the parent.

    This patch should apply cleanly on top of the setattr cleanup patches
    that I sent a few weeks ago.

    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton