08 Feb, 2020

2 commits

  • Pull nfsd updates from Bruce Fields:
    "Highlights:

    - Server-to-server copy code from Olga.

    To use it, client and both servers must have support, the target
    server must be able to access the source server over NFSv4.2, and
    the target server must have the inter_copy_offload_enable module
    parameter set.

    - Improvements and bugfixes for the new filehandle cache, especially
    in the container case, from Trond

    - Also from Trond, better reporting of write errors.

    - Y2038 work from Arnd"

    * tag 'nfsd-5.6' of git://linux-nfs.org/~bfields/linux: (55 commits)
    sunrpc: expiry_time should be seconds not timeval
    nfsd: make nfsd_filecache_wq variable static
    nfsd4: fix double free in nfsd4_do_async_copy()
    nfsd: convert file cache to use over/underflow safe refcount
    nfsd: Define the file access mode enum for tracing
    nfsd: Fix a perf warning
    nfsd: Ensure sampling of the write verifier is atomic with the write
    nfsd: Ensure sampling of the commit verifier is atomic with the commit
    sunrpc: clean up cache entry add/remove from hashtable
    sunrpc: Fix potential leaks in sunrpc_cache_unhash()
    nfsd: Ensure exclusion between CLONE and WRITE errors
    nfsd: Pass the nfsd_file as arguments to nfsd4_clone_file_range()
    nfsd: Update the boot verifier on stable writes too.
    nfsd: Fix stable writes
    nfsd: Allow nfsd_vfs_write() to take the nfsd_file as an argument
    nfsd: Fix a soft lockup race in nfsd_file_mark_find_or_create()
    nfsd: Reduce the number of calls to nfsd_file_gc()
    nfsd: Schedule the laundrette regularly irrespective of file errors
    nfsd: Remove unused constant NFSD_FILE_LRU_RESCAN
    nfsd: Containerise filecache laundrette
    ...

    Linus Torvalds
     
  • Fix sparse warning:

    fs/nfsd/filecache.c:55:25: warning:
    symbol 'nfsd_filecache_wq' was not declared. Should it be static?

    Reported-by: Hulk Robot
    Signed-off-by: Chen Zhou
    Signed-off-by: J. Bruce Fields

    Chen Zhou
     

07 Feb, 2020

4 commits


04 Feb, 2020

1 commit

  • The most notable change is DEFINE_SHOW_ATTRIBUTE macro split in
    seq_file.h.

    Conversion rule is:

    llseek => proc_lseek
    unlocked_ioctl => proc_ioctl

    xxx => proc_xxx

    delete ".owner = THIS_MODULE" line

    [akpm@linux-foundation.org: fix drivers/isdn/capi/kcapi_proc.c]
    [sfr@canb.auug.org.au: fix kernel/sched/psi.c]
    Link: http://lkml.kernel.org/r/20200122180545.36222f50@canb.auug.org.au
    Link: http://lkml.kernel.org/r/20191225172546.GB13378@avx2
    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Stephen Rothwell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

23 Jan, 2020

14 commits


04 Jan, 2020

3 commits

  • Fixes coccicheck warning:

    fs/nfsd/nfssvc.c:394:2-14: WARNING: Assignment of 0/1 to bool variable
    fs/nfsd/nfssvc.c:407:2-14: WARNING: Assignment of 0/1 to bool variable
    fs/nfsd/nfssvc.c:422:2-14: WARNING: Assignment of 0/1 to bool variable

    Reported-by: Hulk Robot
    Signed-off-by: zhengbin
    Signed-off-by: J. Bruce Fields

    zhengbin
     
  • Fixes coccicheck warning:

    fs/nfsd/nfs4proc.c:235:1-18: WARNING: Assignment of 0/1 to bool variable
    fs/nfsd/nfs4proc.c:368:1-17: WARNING: Assignment of 0/1 to bool variable

    Reported-by: Hulk Robot
    Signed-off-by: zhengbin
    Signed-off-by: J. Bruce Fields

    zhengbin
     
  • Fixes coccicheck warning:

    fs/nfsd/vfs.c:1389:5-13: WARNING: Assignment of 0/1 to bool variable
    fs/nfsd/vfs.c:1398:5-13: WARNING: Assignment of 0/1 to bool variable
    fs/nfsd/vfs.c:1415:2-10: WARNING: Assignment of 0/1 to bool variable

    Reported-by: Hulk Robot
    Signed-off-by: zhengbin
    Signed-off-by: J. Bruce Fields

    zhengbin
     

20 Dec, 2019

15 commits

  • The function was removed a long time ago, but the declaration
    and a dummy implementation are still there, referencing the
    deprecated time_t type.

    Remove both.

    Fixes: f958a1320ff7 ("nfsd4: remove unnecessary lease-setting function")
    Signed-off-by: Arnd Bergmann
    Signed-off-by: J. Bruce Fields

    Arnd Bergmann
     
  • gen_confirm() generates a unique identifier based on the current
    time. This overflows in year 2038, but that is harmless since it
    generally does not lead to duplicates, as long as the time has
    been initialized by a real-time clock or NTP.

    Using ktime_get_boottime_seconds() or ktime_get_seconds() would
    avoid the overflow, but it would be more likely to result in
    non-unique numbers.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: J. Bruce Fields

    Arnd Bergmann
     
  • A couple of time_t variables are only used to track the state of the
    lease time and its expiration. The code correctly uses the 'time_after()'
    macro to make this work on 32-bit architectures even beyond year 2038,
    but the get_seconds() function and the time_t type itself are deprecated
    as they behave inconsistently between 32-bit and 64-bit architectures
    and often lead to code that is not y2038 safe.

    As a minor issue, using get_seconds() leads to problems with concurrent
    settimeofday() or clock_settime() calls, in the worst case timeout never
    triggering after the time has been set backwards.

    Change nfsd to use time64_t and ktime_get_boottime_seconds() here. This
    is clearly excessive, as boottime by itself means we never go beyond 32
    bits, but it does mean we handle this correctly and consistently without
    having to worry about corner cases and should be no more expensive than
    the previous implementation on 64-bit architectures.

    The max_cb_time() function gets changed in order to avoid an expensive
    64-bit division operation, but as the lease time is at most one hour,
    there is no change in behavior.

    Also do the same for server-to-server copy expiration time.

    Signed-off-by: Arnd Bergmann
    [bfields@redhat.com: fix up copy expiration]
    Signed-off-by: J. Bruce Fields

    Arnd Bergmann
     
  • The nfsd4_blocked_lock->nbl_time timestamp is recorded in jiffies,
    but then compared to a CLOCK_REALTIME timestamp later on, which makes
    no sense.

    For consistency with the other timestamps, change this to use a time_t.

    This is a change in behavior, which may cause regressions, but the
    current code is not sensible. On a system with CONFIG_HZ=1000,
    the 'time_after((unsigned long)nbl->nbl_time, (unsigned long)cutoff))'
    check is false for roughly the first 18 days of uptime and then true
    for the next 49 days.

    Fixes: 7919d0a27f1e ("nfsd: add a LRU list for blocked locks")
    Signed-off-by: Arnd Bergmann
    Signed-off-by: J. Bruce Fields

    Arnd Bergmann
     
  • The nfsd4_cb_layout_done() function takes a 'time_t' value,
    multiplied by NSEC_PER_SEC*2 to get a nanosecond value.

    This works fine on 64-bit architectures, but on 32-bit, any
    value over 1 second results in a signed integer overflow
    with unexpected results.

    Cast one input to a 64-bit type in order to produce the
    same result that we have on 64-bit architectures, regarless
    of the type of nfsd4_lease.

    Fixes: 6b9b21073d3b ("nfsd: give up on CB_LAYOUTRECALLs after two lease periods")
    Signed-off-by: Arnd Bergmann
    Signed-off-by: J. Bruce Fields

    Arnd Bergmann
     
  • Change to time64_t and ktime_get_real_seconds() to make the
    logic work correctly on 32-bit architectures beyond 2038.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: J. Bruce Fields

    Arnd Bergmann
     
  • Guardtime handling in nfs3 differs between 32-bit and 64-bit
    architectures, and uses the deprecated time_t type.

    Change it to using time64_t, which behaves the same way on
    64-bit and 32-bit architectures, treating the number as an
    unsigned 32-bit entity with a range of year 1970 to 2106
    consistently, and avoiding the y2038 overflow.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: J. Bruce Fields

    Arnd Bergmann
     
  • The local boot time variable gets truncated to time_t at the moment,
    which can lead to slightly odd behavior on 32-bit architectures.

    Use ktime_get_real_seconds() instead of get_seconds() to always
    get a 64-bit result, and keep it that way wherever possible.

    It still gets truncated in a few places:

    - When assigning to cl_clientid.cl_boot, this is already documented
    and is only used as a unique identifier.

    - In clients_still_reclaiming(), the truncation is to 'unsigned long'
    in order to use the 'time_before() helper.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: J. Bruce Fields

    Arnd Bergmann
     
  • The values in encode_time_delta are always small and don't
    overflow the range of 'struct timespec', so changing it has
    no effect.

    Change it to timespec64 as a prerequisite for removing the
    timespec definition later.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: J. Bruce Fields

    Arnd Bergmann
     
  • The decode_time3 function behaves differently on 32-bit
    and 64-bit architectures: on the former, a 32-bit timestamp
    gets converted into an signed number and then into a timestamp
    between 1902 and 2038, while on the latter it is interpreted
    as unsigned in the range 1970-2106.

    Change all the remaining 'timespec' in nfsd to 'timespec64'
    to make the behavior the same, and use the current interpretation
    of the dominant 64-bit architectures.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: J. Bruce Fields

    Arnd Bergmann
     
  • The nii_time field gets truncated to 'time_t' on 32-bit architectures
    before printing.

    Remove the use of 'struct timespec' to product the correct output
    beyond 2038.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: J. Bruce Fields

    Arnd Bergmann
     
  • The delegation logic in nfsd uses the somewhat inefficient
    seconds_since_boot() function to record time intervals.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: J. Bruce Fields

    Arnd Bergmann
     
  • The replay variable is set in the only caller of nfsd4_encode_replay.
    The assertion is unnecessary and the patch removes this check.

    Signed-off-by: Aditya Pakki
    Signed-off-by: J. Bruce Fields

    Aditya Pakki
     
  • vfs_clone_file_range() can modify the metadata on the source file too,
    so we need to commit that to stable storage as well.

    Reported-by: Dave Chinner
    Signed-off-by: Trond Myklebust
    Acked-by: Dave Chinner
    Signed-off-by: J. Bruce Fields

    Trond Myklebust
     
  • Fixes coccicheck warning:

    fs/nfsd/nfs4state.c:3376:2-3: Unneeded semicolon

    Reported-by: Hulk Robot
    Signed-off-by: zhengbin
    Signed-off-by: J. Bruce Fields

    zhengbin
     

18 Dec, 2019

1 commit