|
@@ -135,7 +135,7 @@
|
|
#define IS_POSIX(fl) (fl->fl_flags & FL_POSIX)
|
|
#define IS_POSIX(fl) (fl->fl_flags & FL_POSIX)
|
|
#define IS_FLOCK(fl) (fl->fl_flags & FL_FLOCK)
|
|
#define IS_FLOCK(fl) (fl->fl_flags & FL_FLOCK)
|
|
#define IS_LEASE(fl) (fl->fl_flags & (FL_LEASE|FL_DELEG))
|
|
#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)
|
|
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));
|
|
BUG_ON(!list_empty(&waiter->fl_block));
|
|
waiter->fl_next = blocker;
|
|
waiter->fl_next = blocker;
|
|
list_add_tail(&waiter->fl_block, &blocker->fl_block);
|
|
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);
|
|
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.
|
|
* of tasks (such as posix threads) sharing the same open file table.
|
|
* To handle those cases, we just bail out after a few iterations.
|
|
* 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
|
|
* Because the owner is not even nominally tied to a thread of
|
|
* execution, the deadlock detection below can't reasonably work well. Just
|
|
* execution, the deadlock detection below can't reasonably work well. Just
|
|
* skip it for those.
|
|
* 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
|
|
* locks that just checks for the case where two tasks are attempting to
|
|
* upgrade from read to write locks on the same inode.
|
|
* 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
|
|
* 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;
|
|
return 0;
|
|
|
|
|
|
while ((block_fl = what_owner_is_waiting_for(block_fl))) {
|
|
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)
|
|
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
|
|
#if BITS_PER_LONG == 32
|
|
/*
|
|
/*
|
|
* Make sure we can represent the posix lock via
|
|
* 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
|
|
#if BITS_PER_LONG == 32
|
|
static void posix_lock_to_flock64(struct flock64 *flock, struct file_lock *fl)
|
|
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_start = fl->fl_start;
|
|
flock->l_len = fl->fl_end == OFFSET_MAX ? 0 :
|
|
flock->l_len = fl->fl_end == OFFSET_MAX ? 0 :
|
|
fl->fl_end - fl->fl_start + 1;
|
|
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;
|
|
goto out;
|
|
|
|
|
|
cmd = F_GETLK;
|
|
cmd = F_GETLK;
|
|
- file_lock.fl_flags |= FL_FILE_PVT;
|
|
|
|
|
|
+ file_lock.fl_flags |= FL_OFDLCK;
|
|
file_lock.fl_owner = (fl_owner_t)filp;
|
|
file_lock.fl_owner = (fl_owner_t)filp;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2073,7 +2073,7 @@ again:
|
|
|
|
|
|
/*
|
|
/*
|
|
* If the cmd is requesting file-private locks, then set the
|
|
* 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) {
|
|
switch (cmd) {
|
|
case F_OFD_SETLK:
|
|
case F_OFD_SETLK:
|
|
@@ -2082,7 +2082,7 @@ again:
|
|
goto out;
|
|
goto out;
|
|
|
|
|
|
cmd = F_SETLK;
|
|
cmd = F_SETLK;
|
|
- file_lock->fl_flags |= FL_FILE_PVT;
|
|
|
|
|
|
+ file_lock->fl_flags |= FL_OFDLCK;
|
|
file_lock->fl_owner = (fl_owner_t)filp;
|
|
file_lock->fl_owner = (fl_owner_t)filp;
|
|
break;
|
|
break;
|
|
case F_OFD_SETLKW:
|
|
case F_OFD_SETLKW:
|
|
@@ -2091,7 +2091,7 @@ again:
|
|
goto out;
|
|
goto out;
|
|
|
|
|
|
cmd = F_SETLKW;
|
|
cmd = F_SETLKW;
|
|
- file_lock->fl_flags |= FL_FILE_PVT;
|
|
|
|
|
|
+ file_lock->fl_flags |= FL_OFDLCK;
|
|
file_lock->fl_owner = (fl_owner_t)filp;
|
|
file_lock->fl_owner = (fl_owner_t)filp;
|
|
/* Fallthrough */
|
|
/* Fallthrough */
|
|
case F_SETLKW:
|
|
case F_SETLKW:
|
|
@@ -2149,7 +2149,7 @@ int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 __user *l)
|
|
goto out;
|
|
goto out;
|
|
|
|
|
|
cmd = F_GETLK64;
|
|
cmd = F_GETLK64;
|
|
- file_lock.fl_flags |= FL_FILE_PVT;
|
|
|
|
|
|
+ file_lock.fl_flags |= FL_OFDLCK;
|
|
file_lock.fl_owner = (fl_owner_t)filp;
|
|
file_lock.fl_owner = (fl_owner_t)filp;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2208,7 +2208,7 @@ again:
|
|
|
|
|
|
/*
|
|
/*
|
|
* If the cmd is requesting file-private locks, then set the
|
|
* 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) {
|
|
switch (cmd) {
|
|
case F_OFD_SETLK:
|
|
case F_OFD_SETLK:
|
|
@@ -2217,7 +2217,7 @@ again:
|
|
goto out;
|
|
goto out;
|
|
|
|
|
|
cmd = F_SETLK64;
|
|
cmd = F_SETLK64;
|
|
- file_lock->fl_flags |= FL_FILE_PVT;
|
|
|
|
|
|
+ file_lock->fl_flags |= FL_OFDLCK;
|
|
file_lock->fl_owner = (fl_owner_t)filp;
|
|
file_lock->fl_owner = (fl_owner_t)filp;
|
|
break;
|
|
break;
|
|
case F_OFD_SETLKW:
|
|
case F_OFD_SETLKW:
|
|
@@ -2226,7 +2226,7 @@ again:
|
|
goto out;
|
|
goto out;
|
|
|
|
|
|
cmd = F_SETLKW64;
|
|
cmd = F_SETLKW64;
|
|
- file_lock->fl_flags |= FL_FILE_PVT;
|
|
|
|
|
|
+ file_lock->fl_flags |= FL_OFDLCK;
|
|
file_lock->fl_owner = (fl_owner_t)filp;
|
|
file_lock->fl_owner = (fl_owner_t)filp;
|
|
/* Fallthrough */
|
|
/* Fallthrough */
|
|
case F_SETLKW64:
|
|
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 (IS_POSIX(fl)) {
|
|
if (fl->fl_flags & FL_ACCESS)
|
|
if (fl->fl_flags & FL_ACCESS)
|
|
seq_printf(f, "ACCESS");
|
|
seq_printf(f, "ACCESS");
|
|
- else if (IS_FILE_PVT(fl))
|
|
|
|
|
|
+ else if (IS_OFDLCK(fl))
|
|
seq_printf(f, "OFDLCK");
|
|
seq_printf(f, "OFDLCK");
|
|
else
|
|
else
|
|
seq_printf(f, "POSIX ");
|
|
seq_printf(f, "POSIX ");
|