19 May, 2011

37 commits

  • Move extern for cifsConvertToUCS to different header to prevent following warning:

    CHECK fs/cifs/cifs_unicode.c
    fs/cifs/cifs_unicode.c:267:1: warning: symbol 'cifsConvertToUCS' was not declared. Should it be static?

    Signed-off-by: Steve French
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Steve French
     
  • Signed-off-by: Steve French

    Steve French
     
  • Change idmap key name from cifs.cifs_idmap to cifs.idmap.
    Removed unused structure wksidarr and function match_sid().
    Handle errors correctly in function init_cifs().

    Signed-off-by: Shirish Pargaonkar
    Reviewed-by: Jeff Layton
    Signed-off-by: Steve French

    Shirish Pargaonkar
     
  • Previously mount options were copied and updated in the cifs_sb_info
    struct only when CONFIG_CIFS_DFS_UPCALL was enabled. Making this
    information generally available allows us to remove a number of ifdefs,
    extra function params, and temporary variables.

    Reviewed-by: Jeff Layton
    Signed-off-by: Sean Finney
    Signed-off-by: Steve French

    Sean Finney
     
  • A relatively minor nit, but also clarified the "consensus" from the
    preceding comments that it is in fact better to try for the kstrdup
    early and cleanup while cleaning up is still a simple thing to do.

    Reviewed-By: Steve French
    Signed-off-by: Sean Finney
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Sean Finney
     
  • With CONFIG_DFS_UPCALL enabled, maintain the submount options in
    cifs_sb->mountdata, simplifying the code just a bit as well as making
    corner-case allocation problems less likely.

    Reviewed-by: Jeff Layton
    Signed-off-by: Sean Finney
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Sean Finney
     
  • To keep strings passed to cifs_parse_mount_options re-usable (which is
    needed to clean up the DFS referral handling), tokenize a copy of the
    mount options instead. If values are needed from this tokenized string,
    they too must be duplicated (previously, some options were copied and
    others duplicated).

    Since we are not on the critical path and any cleanup is relatively easy,
    the extra memory usage shouldn't be a problem (and it is a bit simpler
    than trying to implement something smarter).

    Reviewed-by: Jeff Layton
    Signed-off-by: Sean Finney
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Sean Finney
     
  • Windows 2008 CIFS servers do not always return PATH_NOT_COVERED when
    attempting to access a DFS share. Therefore, when checking for remote
    shares, unconditionally ask for a DFS referral for the UNC (w/out prepath)
    before continuing with previous behavior of attempting to access the UNC +
    prepath and checking for PATH_NOT_COVERED.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=31092

    Reviewed-by: Jeff Layton
    Signed-off-by: Sean Finney
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Sean Finney
     
  • The logic behind the expansion of DFS referrals is now extracted from
    cifs_mount into a new static function, expand_dfs_referral. This will
    reduce duplicate code in upcoming commits.

    Reviewed-by: Jeff Layton
    Signed-off-by: Sean Finney
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Sean Finney
     
  • It's a bad idea to have macro functions that reference variables more
    than once, as the arguments could have side effects. Turn BCC() into
    a static inlined function instead.

    While we're at it, make it return a void * to discourage anyone from
    dereferencing it as-is.

    Reported-and-acked-by: David Howells
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Jeff Layton
     
  • This is the same patch as originally posted, just with some merge
    conflicts fixed up...

    Currently, the ByteCount is usually converted to host-endian on receive.
    This is confusing however, as we need to keep two sets of routines for
    accessing it, and keep track of when to use each routine. Munging
    received packets like this also limits when the signature can be
    calulated.

    Simplify the code by keeping the received ByteCount in little-endian
    format. This allows us to eliminate a set of routines for accessing it
    and we can now drop the *_le suffixes from the accessor functions since
    that's now implied.

    While we're at it, switch all of the places that read the ByteCount
    directly to use the get_bcc inline which should also clean up some
    unaligned accesses.

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

    Jeff Layton
     
  • fs/cifs/cifsacl.c: In function ‘id_rb_search’:
    fs/cifs/cifsacl.c:215:19: warning: variable ‘linkto’ set but not used
    [-Wunused-but-set-variable]
    fs/cifs/cifsacl.c:214:18: warning: variable ‘parent’ set but not used
    [-Wunused-but-set-variable]

    Reviewed-by: Shirish Pargaonkar
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • Simplify many places when we call cifs_revalidate/invalidate to make
    it do what it exactly needs.

    Reviewed-by: Jeff Layton
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Pavel Shilovsky
     
  • Recently introduced strictcache mode brought a new code that can be
    efficiently used by directio part. That's let us add vectored operations
    and break unnecessary cifs_user_read and cifs_user_write.

    Signed-off-by: Pavel Shilovsky
    Reviewed-by: Jeff Layton
    Signed-off-by: Steve French

    Pavel Shilovsky
     
  • There is one big endian field in the cifs protocol, the RFC1001
    length, which cifs code (unlike in the smb2 code) had been handling as
    u32 until the last possible moment, when it was converted to be32 (its
    native form) before sending on the wire. To remove the last sparse
    endian warning, and to make this consistent with the smb2
    implementation (which always treats the fields in their
    native size and endianness), convert all uses of smb_buf_length to
    be32.

    This version incorporates Christoph's comment about
    using be32_add_cpu, and fixes a typo in the second
    version of the patch.

    Signed-off-by: Steve French
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Steve French
     
  • rb tree search and insertion routines.

    A SID which needs to be mapped, is looked up in one of the rb trees
    depending on whether SID is either owner or group SID.
    If found in the tree, a (mapped) id from that node is assigned to
    uid or gid as appropriate. If unmapped, an upcall is attempted to
    map the SID to an id. If upcall is successful, node is marked as
    mapped. If upcall fails, node stays marked as unmapped and a mapping
    is attempted again only after an arbitrary time period has passed.

    To map a SID, which can be either a Owner SID or a Group SID, key
    description starts with the string "os" or "gs" followed by SID converted
    to a string. Without "os" or "gs", cifs.upcall does not know whether
    SID needs to be mapped to either an uid or a gid.

    Nodes in rb tree have fields to prevent multiple upcalls for
    a SID. Searching, adding, and removing nodes is done within global locks.
    Whenever a node is either found or inserted in a tree, a reference
    is taken on that node.
    Shrinker routine prunes a node if it has expired but does not prune
    an expired node if its refcount is not zero (i.e. sid/id of that node
    is_being/will_be accessed).
    Thus a node, if its SID needs to be mapped by making an upcall,
    can safely stay and its fields accessed without shrinker pruning it.
    A reference (refcount) is put on the node without holding the spinlock
    but a reference is get on the node by holding the spinlock.

    Every time an existing mapped node is accessed or mapping is attempted,
    its timestamp is updated to prevent it from getting erased or a
    to prevent multiple unnecessary repeat mapping retries respectively.

    For now, cifs.upcall is only used to map a SID to an id (uid or gid) but
    it would be used to obtain an SID for an id.

    Signed-off-by: Shirish Pargaonkar
    Reviewed-by: Jeff Layton
    Signed-off-by: Steve French

    Shirish Pargaonkar
     
  • Define (global) data structures to store ids, uids and gids, to which a
    SID maps. There are two separate trees, one for SID/uid and another one
    for SID/gid.

    A new type of key, cifs_idmap_key_type, is used.

    Keys are instantiated and searched using credential of the root by
    overriding and restoring the credentials of the caller requesting the key.

    Id mapping functions are invoked under config option of cifs acl.

    Signed-off-by: Shirish Pargaonkar
    Signed-off-by: Steve French

    Shirish Pargaonkar
     
  • Add this let us drop filemap_write_and_wait from cifs_invalidate_mapping
    and simplify the code to properly process invalidate logic.

    Reviewed-by: Jeff Layton
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Pavel Shilovsky
     
  • As with Linux nfs client, which uses "nfsvers=" or "vers=" to
    indicate which protocol to use for mount, specifying

    "vers=smb2" or "vers=2"

    will force an smb2 mount. When vers is not specified cifs is used

    ie "vers=cifs" or "vers=1"

    We can eventually autonegotiate down from smb2 to cifs
    when smb2 is stable enough to make it the default, but this
    is for the future. At that time we could also implement a
    "maxprotocol" mount option as smbclient and Samba have today,
    but that would be premature until smb2 is stable.

    Intially the smb2 Kconfig option will depend on "BROKEN"
    until the merge is complete, and then be "EXPERIMENTAL"
    When it is no longer experimental we can consider changing
    the default protocol to attempt first.

    Reviewed-by: Jeff Layton
    Reviewed-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Steve French
     
  • Use invalidate_inode_pages2 that don't leave pages even if shrink_page_list()
    has a temp ref on them. It prevents a data coherency problem when
    cifs_invalidate_mapping didn't invalidate pages but the client thinks that a data
    from the cache is uptodate according to an oplock level (exclusive or II).

    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Pavel Shilovsky
     
  • The comment about checking the bcc is in the wrong place. Also make it
    match kernel coding style.

    Reported-and-acked-by: David Howells
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • I originally intended to remove this warning in 2.6.34, but it's not in
    a high performance codepath and might help us to catch bugs later. Let's
    keep it, but fix the comment to allay confusion about its removal.

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

    Jeff Layton
     
  • Allow setting cifs_acl on the server.
    Pass on to the server the ACL blob generated by an application.
    cifs is just a pass-through, it does not monitor or inspect the contents
    of the blob, server decides whether to enforce/apply the ACL blob composed
    by an application.
    If setting of ACL is succeessful, mark the inode for revalidation.

    Signed-off-by: Shirish Pargaonkar
    Acked-by: Jeff Layton
    Signed-off-by: Steve French

    Steve French
     
  • local cifs functions (repost)

    Using kernel crypto APIs for DES encryption during LM and NT hash generation
    instead of local functions within cifs.
    Source file smbdes.c is deleted sans four functions, one of which
    uses ecb des functionality provided by kernel crypto APIs.

    Remove function SMBOWFencrypt.

    Add return codes to various functions such as calc_lanman_hash,
    SMBencrypt, and SMBNTencrypt. Includes fix noticed by Dan Carpenter.

    Signed-off-by: Shirish Pargaonkar
    CC: Dan Carpenter
    Acked-by: Jeff Layton
    Signed-off-by: Steve French

    Steve French
     
  • Remove config flag CIFS_EXPERIMENTAL.
    Do export operations under new config flag CIFS_NFSD_EXPORT

    Signed-off-by: Shirish Pargaonkar
    Reviewed-by: Jeff Layton
    Signed-off-by: Steve French

    Shirish Pargaonkar
     
  • SMB2 is the followon to the CIFS (and SMB) protocols
    and the default for Windows since Windows Vista, and also
    now implemented by various non-Windows servers. SMB2
    is more secure, has various performance advantages, including
    larger i/o sizes, flow control, better caching model and more.
    SMB2 also resolves some scalability limits in the cifs
    protocol and adds many new features while being much
    simpler (only a few dozen commands instead of hundreds)
    and since the protocol is clearer it is
    also more consistently implemented across servers
    and thus easier to optimize.

    After much discussion with Jeff Layton, Jeremy Allison
    and others at Connectathon, we decided to move the smb2
    code from a distinct .ko and fstype into distinct
    C files that optionally build in cifs.ko. As a result
    the Kconfig gets simpler.

    To avoid destabilizing cifs, the smb2 code is going
    to be moved into its own experimental CONFIG_CIFS_SMB2 ifdef
    as it is merged and rereviewed. The changes to stable
    cifs (builds with the smb2 ifdef off) are expected to be
    fairly small.

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

    Steve French
     
  • We were reserving MAX_USERNAME (now 256) on stack for
    something which only needs to fit about 24 bytes ie
    string krb50x + printf version of uid

    Signed-off-by: Steve French

    Steve French
     
  • The patch below removes an extra "l" in the word.

    Signed-off-by: Justin P. Mattock
    Signed-off-by: Steve French

    Justin P. Mattock
     
  • Recent Windows versions now create symlinks more frequently
    and they do use this "reparse point" symlink mechanism. We can of course
    do symlinks nicely to Samba and other servers which support the
    CIFS Unix Extensions and we can also do SFU symlinks and "client only"
    "MF" symlinks optionally, but for recent Windows we currently can not
    handle the common "reparse point" symlinks fully, removing the caller
    for this. We will need to extend and reenable this "reparse point" worker
    code in cifs and fix cifs_symlink to call this. In the interim this code
    has been moved to its own config option so it is not compiled in by default
    until cifs_symlink fixed up (and tested) to use this.

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

    Steve French
     
  • The CIFSSMBNotify worker is unused, pending changes to allow it to be called
    via inotify, so move it into its own experimental config option so it does
    not get built in, until the necessary VFS support is fixed. It used to
    be used in dnotify, but according to Jeff, inotify needs minor changes
    before we can reenable this.

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

    Steve French
     
  • ino is unused in function cifs_root_iget().

    Signed-off-by: Shirish Pargaonkar
    Signed-off-by: Steve French

    Shirish Pargaonkar
     
  • Linus Torvalds
     
  • * 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2:
    configfs: Fix race between configfs_readdir() and configfs_d_iput()
    configfs: Don't try to d_delete() negative dentries.
    ocfs2/dlm: Target node death during resource migration leads to thread spin
    ocfs2: Skip mount recovery for hard-ro mounts
    ocfs2/cluster: Heartbeat mismatch message improved
    ocfs2/cluster: Increase the live threshold for global heartbeat
    ocfs2/dlm: Use negotiated o2dlm protocol version
    ocfs2: skip existing hole when removing the last extent_rec in punching-hole codes.
    ocfs2: Initialize data_ac (might be used uninitialized)

    Linus Torvalds
     
  • * 'devicetree/merge' of git://git.secretlab.ca/git/linux-2.6:
    drivercore: revert addition of of_match to struct device
    of: fix race when matching drivers

    Linus Torvalds
     
  • * 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus:
    MIPS: Kludge IP27 build for 2.6.39.
    MIPS: AR7: Fix GPIO register size for Titan variant.
    MIPS: Fix duplicate invocation of notify_die.
    MIPS: RB532: Fix iomap resource size miscalculation.

    Linus Torvalds
     
  • Commit b826291c, "drivercore/dt: add a match table pointer to struct
    device" added an of_match pointer to struct device to cache the
    of_match_table entry discovered at driver match time. This was unsafe
    because matching is not an atomic operation with probing a driver. If
    two or more drivers are attempted to be matched to a driver at the
    same time, then the cached matching entry pointer could get
    overwritten.

    This patch reverts the of_match cache pointer and reworks all users to
    call of_match_device() directly instead.

    Signed-off-by: Grant Likely

    Grant Likely
     
  • If two drivers are probing devices at the same time, both will write
    their match table result to the dev->of_match cache at the same time.

    Only write the result if the device matches.

    In a thread titled "SBus devices sometimes detected, sometimes not",
    Meelis reported his SBus hme was not detected about 50% of the time.
    From the debug suggested by Grant it was obvious another driver matched
    some devices between the call to match the hme and the hme discovery
    failling.

    Reported-by: Meelis Roos
    Signed-off-by: Milton Miller
    [grant.likely: modified to only call of_match_device() once]
    Signed-off-by: Grant Likely

    Milton Miller
     

18 May, 2011

3 commits

  • * 'for-linus' of git://git.kernel.dk/linux-2.6-block:
    block: don't delay blk_run_queue_async
    scsi: remove performance regression due to async queue run
    blk-throttle: Use task_subsys_state() to determine a task's blkio_cgroup
    block: rescan partitions on invalidated devices on -ENOMEDIA too
    cdrom: always check_disk_change() on open
    block: unexport DISK_EVENT_MEDIA_CHANGE for legacy/fringe drivers

    Linus Torvalds
     
  • Signed-off-by: Ralf Baechle

    Ralf Baechle
     
  • The 'size' variable contains the correct register size for both AR7
    and Titan, but we never used it to ioremap the correct register size.
    This problem only shows up on Titan.

    [ralf@linux-mips.org: Fixed the fix. The original patch as in patchwork
    recognizes the problem correctly then fails to fix it ...]

    Reported-by: Alexander Clouter
    Signed-off-by: Florian Fainelli
    Patchwork: https://patchwork.linux-mips.org/patch/2380/
    Signed-off-by: Ralf Baechle

    Florian Fainelli