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