locks: rename FL_FILE_PVT and IS_FILE_PVT to use "*_OFDLCK" instead
File-private locks have been re-christened as "open file description" locks. Finish the symbol name cleanup in the internal implementation. Signed-off-by: Jeff Layton <jlayton@redhat.com>
This commit is contained in:
parent
0d3f7a2dd2
commit
cff2fce58b
34
fs/locks.c
34
fs/locks.c
|
@ -135,7 +135,7 @@
|
|||
#define IS_POSIX(fl) (fl->fl_flags & FL_POSIX)
|
||||
#define IS_FLOCK(fl) (fl->fl_flags & FL_FLOCK)
|
||||
#define IS_LEASE(fl) (fl->fl_flags & (FL_LEASE|FL_DELEG))
|
||||
#define IS_FILE_PVT(fl) (fl->fl_flags & FL_FILE_PVT)
|
||||
#define IS_OFDLCK(fl) (fl->fl_flags & FL_OFDLCK)
|
||||
|
||||
static bool lease_breaking(struct file_lock *fl)
|
||||
{
|
||||
|
@ -564,7 +564,7 @@ static void __locks_insert_block(struct file_lock *blocker,
|
|||
BUG_ON(!list_empty(&waiter->fl_block));
|
||||
waiter->fl_next = blocker;
|
||||
list_add_tail(&waiter->fl_block, &blocker->fl_block);
|
||||
if (IS_POSIX(blocker) && !IS_FILE_PVT(blocker))
|
||||
if (IS_POSIX(blocker) && !IS_OFDLCK(blocker))
|
||||
locks_insert_global_blocked(waiter);
|
||||
}
|
||||
|
||||
|
@ -759,12 +759,12 @@ EXPORT_SYMBOL(posix_test_lock);
|
|||
* of tasks (such as posix threads) sharing the same open file table.
|
||||
* To handle those cases, we just bail out after a few iterations.
|
||||
*
|
||||
* For FL_FILE_PVT locks, the owner is the filp, not the files_struct.
|
||||
* For FL_OFDLCK locks, the owner is the filp, not the files_struct.
|
||||
* Because the owner is not even nominally tied to a thread of
|
||||
* execution, the deadlock detection below can't reasonably work well. Just
|
||||
* skip it for those.
|
||||
*
|
||||
* In principle, we could do a more limited deadlock detection on FL_FILE_PVT
|
||||
* In principle, we could do a more limited deadlock detection on FL_OFDLCK
|
||||
* locks that just checks for the case where two tasks are attempting to
|
||||
* upgrade from read to write locks on the same inode.
|
||||
*/
|
||||
|
@ -791,9 +791,9 @@ static int posix_locks_deadlock(struct file_lock *caller_fl,
|
|||
|
||||
/*
|
||||
* This deadlock detector can't reasonably detect deadlocks with
|
||||
* FL_FILE_PVT locks, since they aren't owned by a process, per-se.
|
||||
* FL_OFDLCK locks, since they aren't owned by a process, per-se.
|
||||
*/
|
||||
if (IS_FILE_PVT(caller_fl))
|
||||
if (IS_OFDLCK(caller_fl))
|
||||
return 0;
|
||||
|
||||
while ((block_fl = what_owner_is_waiting_for(block_fl))) {
|
||||
|
@ -1890,7 +1890,7 @@ EXPORT_SYMBOL_GPL(vfs_test_lock);
|
|||
|
||||
static int posix_lock_to_flock(struct flock *flock, struct file_lock *fl)
|
||||
{
|
||||
flock->l_pid = IS_FILE_PVT(fl) ? -1 : fl->fl_pid;
|
||||
flock->l_pid = IS_OFDLCK(fl) ? -1 : fl->fl_pid;
|
||||
#if BITS_PER_LONG == 32
|
||||
/*
|
||||
* Make sure we can represent the posix lock via
|
||||
|
@ -1912,7 +1912,7 @@ static int posix_lock_to_flock(struct flock *flock, struct file_lock *fl)
|
|||
#if BITS_PER_LONG == 32
|
||||
static void posix_lock_to_flock64(struct flock64 *flock, struct file_lock *fl)
|
||||
{
|
||||
flock->l_pid = IS_FILE_PVT(fl) ? -1 : fl->fl_pid;
|
||||
flock->l_pid = IS_OFDLCK(fl) ? -1 : fl->fl_pid;
|
||||
flock->l_start = fl->fl_start;
|
||||
flock->l_len = fl->fl_end == OFFSET_MAX ? 0 :
|
||||
fl->fl_end - fl->fl_start + 1;
|
||||
|
@ -1947,7 +1947,7 @@ int fcntl_getlk(struct file *filp, unsigned int cmd, struct flock __user *l)
|
|||
goto out;
|
||||
|
||||
cmd = F_GETLK;
|
||||
file_lock.fl_flags |= FL_FILE_PVT;
|
||||
file_lock.fl_flags |= FL_OFDLCK;
|
||||
file_lock.fl_owner = (fl_owner_t)filp;
|
||||
}
|
||||
|
||||
|
@ -2073,7 +2073,7 @@ again:
|
|||
|
||||
/*
|
||||
* If the cmd is requesting file-private locks, then set the
|
||||
* FL_FILE_PVT flag and override the owner.
|
||||
* FL_OFDLCK flag and override the owner.
|
||||
*/
|
||||
switch (cmd) {
|
||||
case F_OFD_SETLK:
|
||||
|
@ -2082,7 +2082,7 @@ again:
|
|||
goto out;
|
||||
|
||||
cmd = F_SETLK;
|
||||
file_lock->fl_flags |= FL_FILE_PVT;
|
||||
file_lock->fl_flags |= FL_OFDLCK;
|
||||
file_lock->fl_owner = (fl_owner_t)filp;
|
||||
break;
|
||||
case F_OFD_SETLKW:
|
||||
|
@ -2091,7 +2091,7 @@ again:
|
|||
goto out;
|
||||
|
||||
cmd = F_SETLKW;
|
||||
file_lock->fl_flags |= FL_FILE_PVT;
|
||||
file_lock->fl_flags |= FL_OFDLCK;
|
||||
file_lock->fl_owner = (fl_owner_t)filp;
|
||||
/* Fallthrough */
|
||||
case F_SETLKW:
|
||||
|
@ -2149,7 +2149,7 @@ int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 __user *l)
|
|||
goto out;
|
||||
|
||||
cmd = F_GETLK64;
|
||||
file_lock.fl_flags |= FL_FILE_PVT;
|
||||
file_lock.fl_flags |= FL_OFDLCK;
|
||||
file_lock.fl_owner = (fl_owner_t)filp;
|
||||
}
|
||||
|
||||
|
@ -2208,7 +2208,7 @@ again:
|
|||
|
||||
/*
|
||||
* If the cmd is requesting file-private locks, then set the
|
||||
* FL_FILE_PVT flag and override the owner.
|
||||
* FL_OFDLCK flag and override the owner.
|
||||
*/
|
||||
switch (cmd) {
|
||||
case F_OFD_SETLK:
|
||||
|
@ -2217,7 +2217,7 @@ again:
|
|||
goto out;
|
||||
|
||||
cmd = F_SETLK64;
|
||||
file_lock->fl_flags |= FL_FILE_PVT;
|
||||
file_lock->fl_flags |= FL_OFDLCK;
|
||||
file_lock->fl_owner = (fl_owner_t)filp;
|
||||
break;
|
||||
case F_OFD_SETLKW:
|
||||
|
@ -2226,7 +2226,7 @@ again:
|
|||
goto out;
|
||||
|
||||
cmd = F_SETLKW64;
|
||||
file_lock->fl_flags |= FL_FILE_PVT;
|
||||
file_lock->fl_flags |= FL_OFDLCK;
|
||||
file_lock->fl_owner = (fl_owner_t)filp;
|
||||
/* Fallthrough */
|
||||
case F_SETLKW64:
|
||||
|
@ -2412,7 +2412,7 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
|
|||
if (IS_POSIX(fl)) {
|
||||
if (fl->fl_flags & FL_ACCESS)
|
||||
seq_printf(f, "ACCESS");
|
||||
else if (IS_FILE_PVT(fl))
|
||||
else if (IS_OFDLCK(fl))
|
||||
seq_printf(f, "OFDLCK");
|
||||
else
|
||||
seq_printf(f, "POSIX ");
|
||||
|
|
|
@ -815,7 +815,7 @@ static inline struct file *get_file(struct file *f)
|
|||
#define FL_SLEEP 128 /* A blocking lock */
|
||||
#define FL_DOWNGRADE_PENDING 256 /* Lease is being downgraded */
|
||||
#define FL_UNLOCK_PENDING 512 /* Lease is being broken */
|
||||
#define FL_FILE_PVT 1024 /* lock is private to the file */
|
||||
#define FL_OFDLCK 1024 /* lock is "owned" by struct file */
|
||||
|
||||
/*
|
||||
* Special return value from posix_lock_file() and vfs_lock_file() for
|
||||
|
|
Loading…
Reference in New Issue