Skip to content

Commit cff2fce

Browse files
committed
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>
1 parent 0d3f7a2 commit cff2fce

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

fs/locks.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
#define IS_POSIX(fl) (fl->fl_flags & FL_POSIX)
136136
#define IS_FLOCK(fl) (fl->fl_flags & FL_FLOCK)
137137
#define IS_LEASE(fl) (fl->fl_flags & (FL_LEASE|FL_DELEG))
138-
#define IS_FILE_PVT(fl) (fl->fl_flags & FL_FILE_PVT)
138+
#define IS_OFDLCK(fl) (fl->fl_flags & FL_OFDLCK)
139139

140140
static bool lease_breaking(struct file_lock *fl)
141141
{
@@ -564,7 +564,7 @@ static void __locks_insert_block(struct file_lock *blocker,
564564
BUG_ON(!list_empty(&waiter->fl_block));
565565
waiter->fl_next = blocker;
566566
list_add_tail(&waiter->fl_block, &blocker->fl_block);
567-
if (IS_POSIX(blocker) && !IS_FILE_PVT(blocker))
567+
if (IS_POSIX(blocker) && !IS_OFDLCK(blocker))
568568
locks_insert_global_blocked(waiter);
569569
}
570570

@@ -759,12 +759,12 @@ EXPORT_SYMBOL(posix_test_lock);
759759
* of tasks (such as posix threads) sharing the same open file table.
760760
* To handle those cases, we just bail out after a few iterations.
761761
*
762-
* For FL_FILE_PVT locks, the owner is the filp, not the files_struct.
762+
* For FL_OFDLCK locks, the owner is the filp, not the files_struct.
763763
* Because the owner is not even nominally tied to a thread of
764764
* execution, the deadlock detection below can't reasonably work well. Just
765765
* skip it for those.
766766
*
767-
* In principle, we could do a more limited deadlock detection on FL_FILE_PVT
767+
* In principle, we could do a more limited deadlock detection on FL_OFDLCK
768768
* locks that just checks for the case where two tasks are attempting to
769769
* upgrade from read to write locks on the same inode.
770770
*/
@@ -791,9 +791,9 @@ static int posix_locks_deadlock(struct file_lock *caller_fl,
791791

792792
/*
793793
* This deadlock detector can't reasonably detect deadlocks with
794-
* FL_FILE_PVT locks, since they aren't owned by a process, per-se.
794+
* FL_OFDLCK locks, since they aren't owned by a process, per-se.
795795
*/
796-
if (IS_FILE_PVT(caller_fl))
796+
if (IS_OFDLCK(caller_fl))
797797
return 0;
798798

799799
while ((block_fl = what_owner_is_waiting_for(block_fl))) {
@@ -1890,7 +1890,7 @@ EXPORT_SYMBOL_GPL(vfs_test_lock);
18901890

18911891
static int posix_lock_to_flock(struct flock *flock, struct file_lock *fl)
18921892
{
1893-
flock->l_pid = IS_FILE_PVT(fl) ? -1 : fl->fl_pid;
1893+
flock->l_pid = IS_OFDLCK(fl) ? -1 : fl->fl_pid;
18941894
#if BITS_PER_LONG == 32
18951895
/*
18961896
* 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)
19121912
#if BITS_PER_LONG == 32
19131913
static void posix_lock_to_flock64(struct flock64 *flock, struct file_lock *fl)
19141914
{
1915-
flock->l_pid = IS_FILE_PVT(fl) ? -1 : fl->fl_pid;
1915+
flock->l_pid = IS_OFDLCK(fl) ? -1 : fl->fl_pid;
19161916
flock->l_start = fl->fl_start;
19171917
flock->l_len = fl->fl_end == OFFSET_MAX ? 0 :
19181918
fl->fl_end - fl->fl_start + 1;
@@ -1947,7 +1947,7 @@ int fcntl_getlk(struct file *filp, unsigned int cmd, struct flock __user *l)
19471947
goto out;
19481948

19491949
cmd = F_GETLK;
1950-
file_lock.fl_flags |= FL_FILE_PVT;
1950+
file_lock.fl_flags |= FL_OFDLCK;
19511951
file_lock.fl_owner = (fl_owner_t)filp;
19521952
}
19531953

@@ -2073,7 +2073,7 @@ int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd,
20732073

20742074
/*
20752075
* If the cmd is requesting file-private locks, then set the
2076-
* FL_FILE_PVT flag and override the owner.
2076+
* FL_OFDLCK flag and override the owner.
20772077
*/
20782078
switch (cmd) {
20792079
case F_OFD_SETLK:
@@ -2082,7 +2082,7 @@ int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd,
20822082
goto out;
20832083

20842084
cmd = F_SETLK;
2085-
file_lock->fl_flags |= FL_FILE_PVT;
2085+
file_lock->fl_flags |= FL_OFDLCK;
20862086
file_lock->fl_owner = (fl_owner_t)filp;
20872087
break;
20882088
case F_OFD_SETLKW:
@@ -2091,7 +2091,7 @@ int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd,
20912091
goto out;
20922092

20932093
cmd = F_SETLKW;
2094-
file_lock->fl_flags |= FL_FILE_PVT;
2094+
file_lock->fl_flags |= FL_OFDLCK;
20952095
file_lock->fl_owner = (fl_owner_t)filp;
20962096
/* Fallthrough */
20972097
case F_SETLKW:
@@ -2149,7 +2149,7 @@ int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 __user *l)
21492149
goto out;
21502150

21512151
cmd = F_GETLK64;
2152-
file_lock.fl_flags |= FL_FILE_PVT;
2152+
file_lock.fl_flags |= FL_OFDLCK;
21532153
file_lock.fl_owner = (fl_owner_t)filp;
21542154
}
21552155

@@ -2208,7 +2208,7 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd,
22082208

22092209
/*
22102210
* If the cmd is requesting file-private locks, then set the
2211-
* FL_FILE_PVT flag and override the owner.
2211+
* FL_OFDLCK flag and override the owner.
22122212
*/
22132213
switch (cmd) {
22142214
case F_OFD_SETLK:
@@ -2217,7 +2217,7 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd,
22172217
goto out;
22182218

22192219
cmd = F_SETLK64;
2220-
file_lock->fl_flags |= FL_FILE_PVT;
2220+
file_lock->fl_flags |= FL_OFDLCK;
22212221
file_lock->fl_owner = (fl_owner_t)filp;
22222222
break;
22232223
case F_OFD_SETLKW:
@@ -2226,7 +2226,7 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd,
22262226
goto out;
22272227

22282228
cmd = F_SETLKW64;
2229-
file_lock->fl_flags |= FL_FILE_PVT;
2229+
file_lock->fl_flags |= FL_OFDLCK;
22302230
file_lock->fl_owner = (fl_owner_t)filp;
22312231
/* Fallthrough */
22322232
case F_SETLKW64:
@@ -2412,7 +2412,7 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
24122412
if (IS_POSIX(fl)) {
24132413
if (fl->fl_flags & FL_ACCESS)
24142414
seq_printf(f, "ACCESS");
2415-
else if (IS_FILE_PVT(fl))
2415+
else if (IS_OFDLCK(fl))
24162416
seq_printf(f, "OFDLCK");
24172417
else
24182418
seq_printf(f, "POSIX ");

include/linux/fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ static inline struct file *get_file(struct file *f)
815815
#define FL_SLEEP 128 /* A blocking lock */
816816
#define FL_DOWNGRADE_PENDING 256 /* Lease is being downgraded */
817817
#define FL_UNLOCK_PENDING 512 /* Lease is being broken */
818-
#define FL_FILE_PVT 1024 /* lock is private to the file */
818+
#define FL_OFDLCK 1024 /* lock is "owned" by struct file */
819819

820820
/*
821821
* Special return value from posix_lock_file() and vfs_lock_file() for

0 commit comments

Comments
 (0)