• Meetakshi Setiya's avatar
    smb: client: reuse file lease key in compound operations · 2c7d399e
    Meetakshi Setiya authored
    Currently, when a rename, unlink or set path size compound operation
    is requested on a file that has a lot of dirty pages to be written
    to the server, we do not send the lease key for these requests. As a
    result, the server can assume that this request is from a new client, and
    send a lease break notification to the same client, on the same
    connection. As a response to the lease break, the client can consume
    several credits to write the dirty pages to the server. Depending on the
    server's credit grant implementation, the server can stop granting more
    credits to this connection, and this can cause a deadlock (which can only
    be resolved when the lease timer on the server expires).
    One of the problems here is that the client is sending no lease key,
    even if it has a lease for the file. This patch fixes the problem by
    reusing the existing lease key on the file for rename, unlink and set path
    size compound operations so that the client does not break its own lease.
    
    A very trivial example could be a set of commands by a client that
    maintains open handle (for write) to a file and then tries to copy the
    contents of that file to another one, eg.,
    
    tail -f /dev/null > myfile &
    mv myfile myfile2
    
    Presently, the network capture on the client shows that the move (or
    rename) would trigger a lease break on the same client, for the same file.
    With the lease key reused, the lease break request-response overhead is
    eliminated, thereby reducing the roundtrips performed for this set of
    operations.
    
    The patch fixes the bug described above and also provides perf benefit.
    Signed-off-by: default avatarMeetakshi Setiya <msetiya@microsoft.com>
    Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
    2c7d399e
smb2inode.c 29.1 KB