Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'locks-v3.15-2' of git://git.samba.org/jlayton/linux

Pull file locking fixes from Jeff Layton:
"File locking related bugfixes for v3.15 (pile #2)

- fix for a long-standing bug in __break_lease that can cause soft
lockups
- renaming of file-private locks to "open file description" locks,
and the command macros to more visually distinct names

The fix for __break_lease is also in the pile of patches for which
Bruce sent a pull request, but I assume that your merge procedure will
handle that correctly.

For the other patches, I don't like the fact that we need to rename
this stuff at this late stage, but it should be settled now
(hopefully)"

* tag 'locks-v3.15-2' of git://git.samba.org/jlayton/linux:
locks: rename FL_FILE_PVT and IS_FILE_PVT to use "*_OFDLCK" instead
locks: rename file-private locks to "open file description locks"
locks: allow __break_lease to sleep even when break_time is 0

+54 -54
+3 -3
arch/arm/kernel/sys_oabi-compat.c
··· 203 203 int ret; 204 204 205 205 switch (cmd) { 206 - case F_GETLKP: 207 - case F_SETLKP: 208 - case F_SETLKPW: 206 + case F_OFD_GETLK: 207 + case F_OFD_SETLK: 208 + case F_OFD_SETLKW: 209 209 case F_GETLK64: 210 210 case F_SETLK64: 211 211 case F_SETLKW64:
+7 -7
fs/compat.c
··· 457 457 case F_GETLK64: 458 458 case F_SETLK64: 459 459 case F_SETLKW64: 460 - case F_GETLKP: 461 - case F_SETLKP: 462 - case F_SETLKPW: 460 + case F_OFD_GETLK: 461 + case F_OFD_SETLK: 462 + case F_OFD_SETLKW: 463 463 ret = get_compat_flock64(&f, compat_ptr(arg)); 464 464 if (ret != 0) 465 465 break; ··· 468 468 conv_cmd = convert_fcntl_cmd(cmd); 469 469 ret = sys_fcntl(fd, conv_cmd, (unsigned long)&f); 470 470 set_fs(old_fs); 471 - if ((conv_cmd == F_GETLK || conv_cmd == F_GETLKP) && ret == 0) { 471 + if ((conv_cmd == F_GETLK || conv_cmd == F_OFD_GETLK) && ret == 0) { 472 472 /* need to return lock information - see above for commentary */ 473 473 if (f.l_start > COMPAT_LOFF_T_MAX) 474 474 ret = -EOVERFLOW; ··· 493 493 case F_GETLK64: 494 494 case F_SETLK64: 495 495 case F_SETLKW64: 496 - case F_GETLKP: 497 - case F_SETLKP: 498 - case F_SETLKPW: 496 + case F_OFD_GETLK: 497 + case F_OFD_SETLK: 498 + case F_OFD_SETLKW: 499 499 return -EINVAL; 500 500 } 501 501 return compat_sys_fcntl64(fd, cmd, arg);
+6 -6
fs/fcntl.c
··· 274 274 break; 275 275 #if BITS_PER_LONG != 32 276 276 /* 32-bit arches must use fcntl64() */ 277 - case F_GETLKP: 277 + case F_OFD_GETLK: 278 278 #endif 279 279 case F_GETLK: 280 280 err = fcntl_getlk(filp, cmd, (struct flock __user *) arg); 281 281 break; 282 282 #if BITS_PER_LONG != 32 283 283 /* 32-bit arches must use fcntl64() */ 284 - case F_SETLKP: 285 - case F_SETLKPW: 284 + case F_OFD_SETLK: 285 + case F_OFD_SETLKW: 286 286 #endif 287 287 /* Fallthrough */ 288 288 case F_SETLK: ··· 399 399 400 400 switch (cmd) { 401 401 case F_GETLK64: 402 - case F_GETLKP: 402 + case F_OFD_GETLK: 403 403 err = fcntl_getlk64(f.file, cmd, (struct flock64 __user *) arg); 404 404 break; 405 405 case F_SETLK64: 406 406 case F_SETLKW64: 407 - case F_SETLKP: 408 - case F_SETLKPW: 407 + case F_OFD_SETLK: 408 + case F_OFD_SETLKW: 409 409 err = fcntl_setlk64(fd, f.file, cmd, 410 410 (struct flock64 __user *) arg); 411 411 break;
+24 -24
fs/locks.c
··· 135 135 #define IS_POSIX(fl) (fl->fl_flags & FL_POSIX) 136 136 #define IS_FLOCK(fl) (fl->fl_flags & FL_FLOCK) 137 137 #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) 139 139 140 140 static bool lease_breaking(struct file_lock *fl) 141 141 { ··· 564 564 BUG_ON(!list_empty(&waiter->fl_block)); 565 565 waiter->fl_next = blocker; 566 566 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)) 568 568 locks_insert_global_blocked(waiter); 569 569 } 570 570 ··· 759 759 * of tasks (such as posix threads) sharing the same open file table. 760 760 * To handle those cases, we just bail out after a few iterations. 761 761 * 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. 763 763 * Because the owner is not even nominally tied to a thread of 764 764 * execution, the deadlock detection below can't reasonably work well. Just 765 765 * skip it for those. 766 766 * 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 768 768 * locks that just checks for the case where two tasks are attempting to 769 769 * upgrade from read to write locks on the same inode. 770 770 */ ··· 791 791 792 792 /* 793 793 * 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. 795 795 */ 796 - if (IS_FILE_PVT(caller_fl)) 796 + if (IS_OFDLCK(caller_fl)) 797 797 return 0; 798 798 799 799 while ((block_fl = what_owner_is_waiting_for(block_fl))) { ··· 1890 1890 1891 1891 static int posix_lock_to_flock(struct flock *flock, struct file_lock *fl) 1892 1892 { 1893 - flock->l_pid = IS_FILE_PVT(fl) ? -1 : fl->fl_pid; 1893 + flock->l_pid = IS_OFDLCK(fl) ? -1 : fl->fl_pid; 1894 1894 #if BITS_PER_LONG == 32 1895 1895 /* 1896 1896 * Make sure we can represent the posix lock via ··· 1912 1912 #if BITS_PER_LONG == 32 1913 1913 static void posix_lock_to_flock64(struct flock64 *flock, struct file_lock *fl) 1914 1914 { 1915 - flock->l_pid = IS_FILE_PVT(fl) ? -1 : fl->fl_pid; 1915 + flock->l_pid = IS_OFDLCK(fl) ? -1 : fl->fl_pid; 1916 1916 flock->l_start = fl->fl_start; 1917 1917 flock->l_len = fl->fl_end == OFFSET_MAX ? 0 : 1918 1918 fl->fl_end - fl->fl_start + 1; ··· 1941 1941 if (error) 1942 1942 goto out; 1943 1943 1944 - if (cmd == F_GETLKP) { 1944 + if (cmd == F_OFD_GETLK) { 1945 1945 error = -EINVAL; 1946 1946 if (flock.l_pid != 0) 1947 1947 goto out; 1948 1948 1949 1949 cmd = F_GETLK; 1950 - file_lock.fl_flags |= FL_FILE_PVT; 1950 + file_lock.fl_flags |= FL_OFDLCK; 1951 1951 file_lock.fl_owner = (fl_owner_t)filp; 1952 1952 } 1953 1953 ··· 2073 2073 2074 2074 /* 2075 2075 * 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. 2077 2077 */ 2078 2078 switch (cmd) { 2079 - case F_SETLKP: 2079 + case F_OFD_SETLK: 2080 2080 error = -EINVAL; 2081 2081 if (flock.l_pid != 0) 2082 2082 goto out; 2083 2083 2084 2084 cmd = F_SETLK; 2085 - file_lock->fl_flags |= FL_FILE_PVT; 2085 + file_lock->fl_flags |= FL_OFDLCK; 2086 2086 file_lock->fl_owner = (fl_owner_t)filp; 2087 2087 break; 2088 - case F_SETLKPW: 2088 + case F_OFD_SETLKW: 2089 2089 error = -EINVAL; 2090 2090 if (flock.l_pid != 0) 2091 2091 goto out; 2092 2092 2093 2093 cmd = F_SETLKW; 2094 - file_lock->fl_flags |= FL_FILE_PVT; 2094 + file_lock->fl_flags |= FL_OFDLCK; 2095 2095 file_lock->fl_owner = (fl_owner_t)filp; 2096 2096 /* Fallthrough */ 2097 2097 case F_SETLKW: ··· 2143 2143 if (error) 2144 2144 goto out; 2145 2145 2146 - if (cmd == F_GETLKP) { 2146 + if (cmd == F_OFD_GETLK) { 2147 2147 error = -EINVAL; 2148 2148 if (flock.l_pid != 0) 2149 2149 goto out; 2150 2150 2151 2151 cmd = F_GETLK64; 2152 - file_lock.fl_flags |= FL_FILE_PVT; 2152 + file_lock.fl_flags |= FL_OFDLCK; 2153 2153 file_lock.fl_owner = (fl_owner_t)filp; 2154 2154 } 2155 2155 ··· 2208 2208 2209 2209 /* 2210 2210 * 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. 2212 2212 */ 2213 2213 switch (cmd) { 2214 - case F_SETLKP: 2214 + case F_OFD_SETLK: 2215 2215 error = -EINVAL; 2216 2216 if (flock.l_pid != 0) 2217 2217 goto out; 2218 2218 2219 2219 cmd = F_SETLK64; 2220 - file_lock->fl_flags |= FL_FILE_PVT; 2220 + file_lock->fl_flags |= FL_OFDLCK; 2221 2221 file_lock->fl_owner = (fl_owner_t)filp; 2222 2222 break; 2223 - case F_SETLKPW: 2223 + case F_OFD_SETLKW: 2224 2224 error = -EINVAL; 2225 2225 if (flock.l_pid != 0) 2226 2226 goto out; 2227 2227 2228 2228 cmd = F_SETLKW64; 2229 - file_lock->fl_flags |= FL_FILE_PVT; 2229 + file_lock->fl_flags |= FL_OFDLCK; 2230 2230 file_lock->fl_owner = (fl_owner_t)filp; 2231 2231 /* Fallthrough */ 2232 2232 case F_SETLKW64: ··· 2412 2412 if (IS_POSIX(fl)) { 2413 2413 if (fl->fl_flags & FL_ACCESS) 2414 2414 seq_printf(f, "ACCESS"); 2415 - else if (IS_FILE_PVT(fl)) 2416 - seq_printf(f, "FLPVT "); 2415 + else if (IS_OFDLCK(fl)) 2416 + seq_printf(f, "OFDLCK"); 2417 2417 else 2418 2418 seq_printf(f, "POSIX "); 2419 2419
+1 -1
include/linux/fs.h
··· 815 815 #define FL_SLEEP 128 /* A blocking lock */ 816 816 #define FL_DOWNGRADE_PENDING 256 /* Lease is being downgraded */ 817 817 #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 */ 819 819 820 820 /* 821 821 * Special return value from posix_lock_file() and vfs_lock_file() for
+10 -10
include/uapi/asm-generic/fcntl.h
··· 133 133 #endif 134 134 135 135 /* 136 - * fd "private" POSIX locks. 136 + * Open File Description Locks 137 137 * 138 - * Usually POSIX locks held by a process are released on *any* close and are 138 + * Usually record locks held by a process are released on *any* close and are 139 139 * not inherited across a fork(). 140 140 * 141 - * These cmd values will set locks that conflict with normal POSIX locks, but 142 - * are "owned" by the opened file, not the process. This means that they are 143 - * inherited across fork() like BSD (flock) locks, and they are only released 144 - * automatically when the last reference to the the open file against which 145 - * they were acquired is put. 141 + * These cmd values will set locks that conflict with process-associated 142 + * record locks, but are "owned" by the open file description, not the 143 + * process. This means that they are inherited across fork() like BSD (flock) 144 + * locks, and they are only released automatically when the last reference to 145 + * the the open file against which they were acquired is put. 146 146 */ 147 - #define F_GETLKP 36 148 - #define F_SETLKP 37 149 - #define F_SETLKPW 38 147 + #define F_OFD_GETLK 36 148 + #define F_OFD_SETLK 37 149 + #define F_OFD_SETLKW 38 150 150 151 151 #define F_OWNER_TID 0 152 152 #define F_OWNER_PID 1
+3 -3
security/selinux/hooks.c
··· 3317 3317 case F_GETLK: 3318 3318 case F_SETLK: 3319 3319 case F_SETLKW: 3320 - case F_GETLKP: 3321 - case F_SETLKP: 3322 - case F_SETLKPW: 3320 + case F_OFD_GETLK: 3321 + case F_OFD_SETLK: 3322 + case F_OFD_SETLKW: 3323 3323 #if BITS_PER_LONG == 32 3324 3324 case F_GETLK64: 3325 3325 case F_SETLK64: