1. 18 Jul, 2022 2 commits
    • Kuniyuki Iwashima's avatar
      fs/lock: Rearrange ops in flock syscall. · db4abb4a
      Kuniyuki Iwashima authored
      The previous patch added flock_translate_cmd() in flock syscall.
      The test and the other one for LOCK_MAND do not depend on struct
      fd and are cheaper, so we can put them at the top and defer
      fdget() after that.
      
      Also, we can remove the unlock variable and use type instead.
      While at it, we fix this checkpatch error.
      
        CHECK: spaces preferred around that '|' (ctx:VxV)
        #45: FILE: fs/locks.c:2099:
        +	if (type != F_UNLCK && !(f.file->f_mode & (FMODE_READ|FMODE_WRITE)))
         	                                                     ^
      
      Finally, we can move the can_sleep part just before we use it.
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
      db4abb4a
    • Kuniyuki Iwashima's avatar
      fs/lock: Don't allocate file_lock in flock_make_lock(). · 4149be7b
      Kuniyuki Iwashima authored
      Two functions, flock syscall and locks_remove_flock(), call
      flock_make_lock().  It allocates struct file_lock from slab
      cache if its argument fl is NULL.
      
      When we call flock syscall, we pass NULL to allocate memory
      for struct file_lock.  However, we always free it at the end
      by locks_free_lock().  We need not allocate it and instead
      should use a local variable as locks_remove_flock() does.
      
      Also, the validation for flock_translate_cmd() is not necessary
      for locks_remove_flock().  So we move the part to flock syscall
      and make flock_make_lock() return nothing.
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Reviewed-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
      4149be7b
  2. 17 Jul, 2022 15 commits
  3. 16 Jul, 2022 12 commits
  4. 15 Jul, 2022 11 commits