locks.c (8335ebd94b3f5bed7875cc35848bbe46d8381695) locks.c (395cf9691d72173d8cdaa613c5f0255f993af94b)
1/*
2 * linux/fs/locks.c
3 *
4 * Provide support for fcntl()'s F_GETLK, F_SETLK, and F_SETLKW calls.
5 * Doug Evans (dje@spiff.uucp), August 07, 1992
6 *
7 * Deadlock detection added.
8 * FIXME: one thing isn't handled yet:

--- 46 unchanged lines hidden (view full) ---

55 *
56 * Addressed Dmitry's concerns. Deadlock checking no longer recursive.
57 * Lock allocation changed to GFP_ATOMIC as we can't afford to sleep
58 * once we've checked for blocking and deadlocking.
59 * Andy Walker (andy@lysaker.kvaerner.no), April 03, 1996.
60 *
61 * Initial implementation of mandatory locks. SunOS turned out to be
62 * a rotten model, so I implemented the "obvious" semantics.
1/*
2 * linux/fs/locks.c
3 *
4 * Provide support for fcntl()'s F_GETLK, F_SETLK, and F_SETLKW calls.
5 * Doug Evans (dje@spiff.uucp), August 07, 1992
6 *
7 * Deadlock detection added.
8 * FIXME: one thing isn't handled yet:

--- 46 unchanged lines hidden (view full) ---

55 *
56 * Addressed Dmitry's concerns. Deadlock checking no longer recursive.
57 * Lock allocation changed to GFP_ATOMIC as we can't afford to sleep
58 * once we've checked for blocking and deadlocking.
59 * Andy Walker (andy@lysaker.kvaerner.no), April 03, 1996.
60 *
61 * Initial implementation of mandatory locks. SunOS turned out to be
62 * a rotten model, so I implemented the "obvious" semantics.
63 * See 'Documentation/mandatory.txt' for details.
63 * See 'Documentation/filesystems/mandatory-locking.txt' for details.
64 * Andy Walker (andy@lysaker.kvaerner.no), April 06, 1996.
65 *
66 * Don't allow mandatory locks on mmap()'ed files. Added simple functions to
67 * check if a file has mandatory locks, used by mmap(), open() and creat() to
68 * see if system call should be rejected. Ref. HP-UX/SunOS/Solaris Reference
69 * Manual, Section 2.
70 * Andy Walker (andy@lysaker.kvaerner.no), April 09, 1996.
71 *

--- 56 unchanged lines hidden (view full) ---

128#include <linux/pid_namespace.h>
129
130#include <asm/uaccess.h>
131
132#define IS_POSIX(fl) (fl->fl_flags & FL_POSIX)
133#define IS_FLOCK(fl) (fl->fl_flags & FL_FLOCK)
134#define IS_LEASE(fl) (fl->fl_flags & FL_LEASE)
135
64 * Andy Walker (andy@lysaker.kvaerner.no), April 06, 1996.
65 *
66 * Don't allow mandatory locks on mmap()'ed files. Added simple functions to
67 * check if a file has mandatory locks, used by mmap(), open() and creat() to
68 * see if system call should be rejected. Ref. HP-UX/SunOS/Solaris Reference
69 * Manual, Section 2.
70 * Andy Walker (andy@lysaker.kvaerner.no), April 09, 1996.
71 *

--- 56 unchanged lines hidden (view full) ---

128#include <linux/pid_namespace.h>
129
130#include <asm/uaccess.h>
131
132#define IS_POSIX(fl) (fl->fl_flags & FL_POSIX)
133#define IS_FLOCK(fl) (fl->fl_flags & FL_FLOCK)
134#define IS_LEASE(fl) (fl->fl_flags & FL_LEASE)
135
136static bool lease_breaking(struct file_lock *fl)
137{
138 return fl->fl_flags & (FL_UNLOCK_PENDING | FL_DOWNGRADE_PENDING);
139}
140
141static int target_leasetype(struct file_lock *fl)
142{
143 if (fl->fl_flags & FL_UNLOCK_PENDING)
144 return F_UNLCK;
145 if (fl->fl_flags & FL_DOWNGRADE_PENDING)
146 return F_RDLCK;
147 return fl->fl_type;
148}
149
150int leases_enable = 1;
151int lease_break_time = 45;
152
153#define for_each_lock(inode, lockp) \
154 for (lockp = &inode->i_flock; *lockp != NULL; lockp = &(*lockp)->fl_next)
155
156static LIST_HEAD(file_lock_list);
157static LIST_HEAD(blocked_list);

--- 970 unchanged lines hidden (view full) ---

1128 break;
1129 }
1130
1131 return error;
1132}
1133
1134EXPORT_SYMBOL(locks_mandatory_area);
1135
136int leases_enable = 1;
137int lease_break_time = 45;
138
139#define for_each_lock(inode, lockp) \
140 for (lockp = &inode->i_flock; *lockp != NULL; lockp = &(*lockp)->fl_next)
141
142static LIST_HEAD(file_lock_list);
143static LIST_HEAD(blocked_list);

--- 970 unchanged lines hidden (view full) ---

1114 break;
1115 }
1116
1117 return error;
1118}
1119
1120EXPORT_SYMBOL(locks_mandatory_area);
1121
1136static void lease_clear_pending(struct file_lock *fl, int arg)
1137{
1138 switch (arg) {
1139 case F_UNLCK:
1140 fl->fl_flags &= ~FL_UNLOCK_PENDING;
1141 /* fall through: */
1142 case F_RDLCK:
1143 fl->fl_flags &= ~FL_DOWNGRADE_PENDING;
1144 }
1145}
1146
1147/* We already had a lease on this file; just change its type */
1148int lease_modify(struct file_lock **before, int arg)
1149{
1150 struct file_lock *fl = *before;
1151 int error = assign_type(fl, arg);
1152
1153 if (error)
1154 return error;
1122/* We already had a lease on this file; just change its type */
1123int lease_modify(struct file_lock **before, int arg)
1124{
1125 struct file_lock *fl = *before;
1126 int error = assign_type(fl, arg);
1127
1128 if (error)
1129 return error;
1155 lease_clear_pending(fl, arg);
1156 locks_wake_up_blocks(fl);
1157 if (arg == F_UNLCK)
1158 locks_delete_lock(before);
1159 return 0;
1160}
1161
1162EXPORT_SYMBOL(lease_modify);
1163
1130 locks_wake_up_blocks(fl);
1131 if (arg == F_UNLCK)
1132 locks_delete_lock(before);
1133 return 0;
1134}
1135
1136EXPORT_SYMBOL(lease_modify);
1137
1164static bool past_time(unsigned long then)
1165{
1166 if (!then)
1167 /* 0 is a special value meaning "this never expires": */
1168 return false;
1169 return time_after(jiffies, then);
1170}
1171
1172static void time_out_leases(struct inode *inode)
1173{
1174 struct file_lock **before;
1175 struct file_lock *fl;
1176
1177 before = &inode->i_flock;
1138static void time_out_leases(struct inode *inode)
1139{
1140 struct file_lock **before;
1141 struct file_lock *fl;
1142
1143 before = &inode->i_flock;
1178 while ((fl = *before) && IS_LEASE(fl) && lease_breaking(fl)) {
1179 if (past_time(fl->fl_downgrade_time))
1180 lease_modify(before, F_RDLCK);
1181 if (past_time(fl->fl_break_time))
1182 lease_modify(before, F_UNLCK);
1144 while ((fl = *before) && IS_LEASE(fl) && (fl->fl_type & F_INPROGRESS)) {
1145 if ((fl->fl_break_time == 0)
1146 || time_before(jiffies, fl->fl_break_time)) {
1147 before = &fl->fl_next;
1148 continue;
1149 }
1150 lease_modify(before, fl->fl_type & ~F_INPROGRESS);
1183 if (fl == *before) /* lease_modify may have freed fl */
1184 before = &fl->fl_next;
1185 }
1186}
1187
1188/**
1189 * __break_lease - revoke all outstanding leases on file
1190 * @inode: the inode of the file to return
1191 * @mode: the open mode (read or write)
1192 *
1193 * break_lease (inlined for speed) has checked there already is at least
1194 * some kind of lock (maybe a lease) on this file. Leases are broken on
1195 * a call to open() or truncate(). This function can sleep unless you
1196 * specified %O_NONBLOCK to your open().
1197 */
1198int __break_lease(struct inode *inode, unsigned int mode)
1199{
1151 if (fl == *before) /* lease_modify may have freed fl */
1152 before = &fl->fl_next;
1153 }
1154}
1155
1156/**
1157 * __break_lease - revoke all outstanding leases on file
1158 * @inode: the inode of the file to return
1159 * @mode: the open mode (read or write)
1160 *
1161 * break_lease (inlined for speed) has checked there already is at least
1162 * some kind of lock (maybe a lease) on this file. Leases are broken on
1163 * a call to open() or truncate(). This function can sleep unless you
1164 * specified %O_NONBLOCK to your open().
1165 */
1166int __break_lease(struct inode *inode, unsigned int mode)
1167{
1200 int error = 0;
1168 int error = 0, future;
1201 struct file_lock *new_fl, *flock;
1202 struct file_lock *fl;
1203 unsigned long break_time;
1204 int i_have_this_lease = 0;
1205 int want_write = (mode & O_ACCMODE) != O_RDONLY;
1206
1207 new_fl = lease_alloc(NULL, want_write ? F_WRLCK : F_RDLCK);
1208
1209 lock_flocks();
1210
1211 time_out_leases(inode);
1212
1213 flock = inode->i_flock;
1214 if ((flock == NULL) || !IS_LEASE(flock))
1215 goto out;
1216
1169 struct file_lock *new_fl, *flock;
1170 struct file_lock *fl;
1171 unsigned long break_time;
1172 int i_have_this_lease = 0;
1173 int want_write = (mode & O_ACCMODE) != O_RDONLY;
1174
1175 new_fl = lease_alloc(NULL, want_write ? F_WRLCK : F_RDLCK);
1176
1177 lock_flocks();
1178
1179 time_out_leases(inode);
1180
1181 flock = inode->i_flock;
1182 if ((flock == NULL) || !IS_LEASE(flock))
1183 goto out;
1184
1217 if (!locks_conflict(flock, new_fl))
1218 goto out;
1219
1220 for (fl = flock; fl && IS_LEASE(fl); fl = fl->fl_next)
1221 if (fl->fl_owner == current->files)
1222 i_have_this_lease = 1;
1223
1185 for (fl = flock; fl && IS_LEASE(fl); fl = fl->fl_next)
1186 if (fl->fl_owner == current->files)
1187 i_have_this_lease = 1;
1188
1189 if (want_write) {
1190 /* If we want write access, we have to revoke any lease. */
1191 future = F_UNLCK | F_INPROGRESS;
1192 } else if (flock->fl_type & F_INPROGRESS) {
1193 /* If the lease is already being broken, we just leave it */
1194 future = flock->fl_type;
1195 } else if (flock->fl_type & F_WRLCK) {
1196 /* Downgrade the exclusive lease to a read-only lease. */
1197 future = F_RDLCK | F_INPROGRESS;
1198 } else {
1199 /* the existing lease was read-only, so we can read too. */
1200 goto out;
1201 }
1202
1224 if (IS_ERR(new_fl) && !i_have_this_lease
1225 && ((mode & O_NONBLOCK) == 0)) {
1226 error = PTR_ERR(new_fl);
1227 goto out;
1228 }
1229
1230 break_time = 0;
1231 if (lease_break_time > 0) {
1232 break_time = jiffies + lease_break_time * HZ;
1233 if (break_time == 0)
1234 break_time++; /* so that 0 means no break time */
1235 }
1236
1237 for (fl = flock; fl && IS_LEASE(fl); fl = fl->fl_next) {
1203 if (IS_ERR(new_fl) && !i_have_this_lease
1204 && ((mode & O_NONBLOCK) == 0)) {
1205 error = PTR_ERR(new_fl);
1206 goto out;
1207 }
1208
1209 break_time = 0;
1210 if (lease_break_time > 0) {
1211 break_time = jiffies + lease_break_time * HZ;
1212 if (break_time == 0)
1213 break_time++; /* so that 0 means no break time */
1214 }
1215
1216 for (fl = flock; fl && IS_LEASE(fl); fl = fl->fl_next) {
1238 if (want_write) {
1239 if (fl->fl_flags & FL_UNLOCK_PENDING)
1240 continue;
1241 fl->fl_flags |= FL_UNLOCK_PENDING;
1217 if (fl->fl_type != future) {
1218 fl->fl_type = future;
1242 fl->fl_break_time = break_time;
1219 fl->fl_break_time = break_time;
1243 } else {
1244 if (lease_breaking(flock))
1245 continue;
1246 fl->fl_flags |= FL_DOWNGRADE_PENDING;
1247 fl->fl_downgrade_time = break_time;
1220 /* lease must have lmops break callback */
1221 fl->fl_lmops->lm_break(fl);
1248 }
1222 }
1249 fl->fl_lmops->lm_break(fl);
1250 }
1251
1252 if (i_have_this_lease || (mode & O_NONBLOCK)) {
1253 error = -EWOULDBLOCK;
1254 goto out;
1255 }
1256
1257restart:

--- 7 unchanged lines hidden (view full) ---

1265 unlock_flocks();
1266 error = wait_event_interruptible_timeout(new_fl->fl_wait,
1267 !new_fl->fl_next, break_time);
1268 lock_flocks();
1269 __locks_delete_block(new_fl);
1270 if (error >= 0) {
1271 if (error == 0)
1272 time_out_leases(inode);
1223 }
1224
1225 if (i_have_this_lease || (mode & O_NONBLOCK)) {
1226 error = -EWOULDBLOCK;
1227 goto out;
1228 }
1229
1230restart:

--- 7 unchanged lines hidden (view full) ---

1238 unlock_flocks();
1239 error = wait_event_interruptible_timeout(new_fl->fl_wait,
1240 !new_fl->fl_next, break_time);
1241 lock_flocks();
1242 __locks_delete_block(new_fl);
1243 if (error >= 0) {
1244 if (error == 0)
1245 time_out_leases(inode);
1273 /*
1274 * Wait for the next conflicting lease that has not been
1275 * broken yet
1276 */
1246 /* Wait for the next lease that has not been broken yet */
1277 for (flock = inode->i_flock; flock && IS_LEASE(flock);
1278 flock = flock->fl_next) {
1247 for (flock = inode->i_flock; flock && IS_LEASE(flock);
1248 flock = flock->fl_next) {
1279 if (locks_conflict(new_fl, flock))
1249 if (flock->fl_type & F_INPROGRESS)
1280 goto restart;
1281 }
1282 error = 0;
1283 }
1284
1285out:
1286 unlock_flocks();
1287 if (!IS_ERR(new_fl))

--- 51 unchanged lines hidden (view full) ---

1339 struct file_lock *fl;
1340 int type = F_UNLCK;
1341
1342 lock_flocks();
1343 time_out_leases(filp->f_path.dentry->d_inode);
1344 for (fl = filp->f_path.dentry->d_inode->i_flock; fl && IS_LEASE(fl);
1345 fl = fl->fl_next) {
1346 if (fl->fl_file == filp) {
1250 goto restart;
1251 }
1252 error = 0;
1253 }
1254
1255out:
1256 unlock_flocks();
1257 if (!IS_ERR(new_fl))

--- 51 unchanged lines hidden (view full) ---

1309 struct file_lock *fl;
1310 int type = F_UNLCK;
1311
1312 lock_flocks();
1313 time_out_leases(filp->f_path.dentry->d_inode);
1314 for (fl = filp->f_path.dentry->d_inode->i_flock; fl && IS_LEASE(fl);
1315 fl = fl->fl_next) {
1316 if (fl->fl_file == filp) {
1347 type = target_leasetype(fl);
1317 type = fl->fl_type & ~F_INPROGRESS;
1348 break;
1349 }
1350 }
1351 unlock_flocks();
1352 return type;
1353}
1354
1318 break;
1319 }
1320 }
1321 unlock_flocks();
1322 return type;
1323}
1324
1355int generic_add_lease(struct file *filp, long arg, struct file_lock **flp)
1325/**
1326 * generic_setlease - sets a lease on an open file
1327 * @filp: file pointer
1328 * @arg: type of lease to obtain
1329 * @flp: input - file_lock to use, output - file_lock inserted
1330 *
1331 * The (input) flp->fl_lmops->lm_break function is required
1332 * by break_lease().
1333 *
1334 * Called with file_lock_lock held.
1335 */
1336int generic_setlease(struct file *filp, long arg, struct file_lock **flp)
1356{
1357 struct file_lock *fl, **before, **my_before = NULL, *lease;
1358 struct dentry *dentry = filp->f_path.dentry;
1359 struct inode *inode = dentry->d_inode;
1337{
1338 struct file_lock *fl, **before, **my_before = NULL, *lease;
1339 struct dentry *dentry = filp->f_path.dentry;
1340 struct inode *inode = dentry->d_inode;
1360 int error;
1341 int error, rdlease_count = 0, wrlease_count = 0;
1361
1362 lease = *flp;
1363
1342
1343 lease = *flp;
1344
1364 error = -EAGAIN;
1365 if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0))
1345 error = -EACCES;
1346 if ((current_fsuid() != inode->i_uid) && !capable(CAP_LEASE))
1366 goto out;
1347 goto out;
1367 if ((arg == F_WRLCK)
1368 && ((dentry->d_count > 1)
1369 || (atomic_read(&inode->i_count) > 1)))
1348 error = -EINVAL;
1349 if (!S_ISREG(inode->i_mode))
1370 goto out;
1350 goto out;
1351 error = security_file_lock(filp, arg);
1352 if (error)
1353 goto out;
1371
1354
1355 time_out_leases(inode);
1356
1357 BUG_ON(!(*flp)->fl_lmops->lm_break);
1358
1359 if (arg != F_UNLCK) {
1360 error = -EAGAIN;
1361 if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0))
1362 goto out;
1363 if ((arg == F_WRLCK)
1364 && ((dentry->d_count > 1)
1365 || (atomic_read(&inode->i_count) > 1)))
1366 goto out;
1367 }
1368
1372 /*
1373 * At this point, we know that if there is an exclusive
1374 * lease on this file, then we hold it on this filp
1375 * (otherwise our open of this file would have blocked).
1376 * And if we are trying to acquire an exclusive lease,
1377 * then the file is not open by anyone (including us)
1378 * except for this filp.
1379 */
1369 /*
1370 * At this point, we know that if there is an exclusive
1371 * lease on this file, then we hold it on this filp
1372 * (otherwise our open of this file would have blocked).
1373 * And if we are trying to acquire an exclusive lease,
1374 * then the file is not open by anyone (including us)
1375 * except for this filp.
1376 */
1380 error = -EAGAIN;
1381 for (before = &inode->i_flock;
1382 ((fl = *before) != NULL) && IS_LEASE(fl);
1383 before = &fl->fl_next) {
1377 for (before = &inode->i_flock;
1378 ((fl = *before) != NULL) && IS_LEASE(fl);
1379 before = &fl->fl_next) {
1384 if (fl->fl_file == filp) {
1380 if (fl->fl_file == filp)
1385 my_before = before;
1381 my_before = before;
1386 continue;
1387 }
1388 /*
1389 * No exclusive leases if someone else has a lease on
1390 * this file:
1391 */
1392 if (arg == F_WRLCK)
1393 goto out;
1394 /*
1395 * Modifying our existing lease is OK, but no getting a
1396 * new lease if someone else is opening for write:
1397 */
1398 if (fl->fl_flags & FL_UNLOCK_PENDING)
1399 goto out;
1382 else if (fl->fl_type == (F_INPROGRESS | F_UNLCK))
1383 /*
1384 * Someone is in the process of opening this
1385 * file for writing so we may not take an
1386 * exclusive lease on it.
1387 */
1388 wrlease_count++;
1389 else
1390 rdlease_count++;
1400 }
1401
1391 }
1392
1393 error = -EAGAIN;
1394 if ((arg == F_RDLCK && (wrlease_count > 0)) ||
1395 (arg == F_WRLCK && ((rdlease_count + wrlease_count) > 0)))
1396 goto out;
1397
1402 if (my_before != NULL) {
1403 error = lease->fl_lmops->lm_change(my_before, arg);
1404 if (!error)
1405 *flp = *my_before;
1406 goto out;
1407 }
1408
1398 if (my_before != NULL) {
1399 error = lease->fl_lmops->lm_change(my_before, arg);
1400 if (!error)
1401 *flp = *my_before;
1402 goto out;
1403 }
1404
1405 if (arg == F_UNLCK)
1406 goto out;
1407
1409 error = -EINVAL;
1410 if (!leases_enable)
1411 goto out;
1412
1413 locks_insert_lock(before, lease);
1414 return 0;
1415
1416out:
1417 return error;
1418}
1408 error = -EINVAL;
1409 if (!leases_enable)
1410 goto out;
1411
1412 locks_insert_lock(before, lease);
1413 return 0;
1414
1415out:
1416 return error;
1417}
1419
1420int generic_delete_lease(struct file *filp, struct file_lock **flp)
1421{
1422 struct file_lock *fl, **before;
1423 struct dentry *dentry = filp->f_path.dentry;
1424 struct inode *inode = dentry->d_inode;
1425
1426 for (before = &inode->i_flock;
1427 ((fl = *before) != NULL) && IS_LEASE(fl);
1428 before = &fl->fl_next) {
1429 if (fl->fl_file != filp)
1430 continue;
1431 return (*flp)->fl_lmops->lm_change(before, F_UNLCK);
1432 }
1433 return -EAGAIN;
1434}
1435
1436/**
1437 * generic_setlease - sets a lease on an open file
1438 * @filp: file pointer
1439 * @arg: type of lease to obtain
1440 * @flp: input - file_lock to use, output - file_lock inserted
1441 *
1442 * The (input) flp->fl_lmops->lm_break function is required
1443 * by break_lease().
1444 *
1445 * Called with file_lock_lock held.
1446 */
1447int generic_setlease(struct file *filp, long arg, struct file_lock **flp)
1448{
1449 struct dentry *dentry = filp->f_path.dentry;
1450 struct inode *inode = dentry->d_inode;
1451 int error;
1452
1453 if ((current_fsuid() != inode->i_uid) && !capable(CAP_LEASE))
1454 return -EACCES;
1455 if (!S_ISREG(inode->i_mode))
1456 return -EINVAL;
1457 error = security_file_lock(filp, arg);
1458 if (error)
1459 return error;
1460
1461 time_out_leases(inode);
1462
1463 BUG_ON(!(*flp)->fl_lmops->lm_break);
1464
1465 switch (arg) {
1466 case F_UNLCK:
1467 return generic_delete_lease(filp, flp);
1468 case F_RDLCK:
1469 case F_WRLCK:
1470 return generic_add_lease(filp, arg, flp);
1471 default:
1472 BUG();
1473 }
1474}
1475EXPORT_SYMBOL(generic_setlease);
1476
1477static int __vfs_setlease(struct file *filp, long arg, struct file_lock **lease)
1478{
1479 if (filp->f_op && filp->f_op->setlease)
1480 return filp->f_op->setlease(filp, arg, lease);
1481 else
1482 return generic_setlease(filp, arg, lease);

--- 695 unchanged lines hidden (view full) ---

2178 } else if (IS_FLOCK(fl)) {
2179 if (fl->fl_type & LOCK_MAND) {
2180 seq_printf(f, "FLOCK MSNFS ");
2181 } else {
2182 seq_printf(f, "FLOCK ADVISORY ");
2183 }
2184 } else if (IS_LEASE(fl)) {
2185 seq_printf(f, "LEASE ");
1418EXPORT_SYMBOL(generic_setlease);
1419
1420static int __vfs_setlease(struct file *filp, long arg, struct file_lock **lease)
1421{
1422 if (filp->f_op && filp->f_op->setlease)
1423 return filp->f_op->setlease(filp, arg, lease);
1424 else
1425 return generic_setlease(filp, arg, lease);

--- 695 unchanged lines hidden (view full) ---

2121 } else if (IS_FLOCK(fl)) {
2122 if (fl->fl_type & LOCK_MAND) {
2123 seq_printf(f, "FLOCK MSNFS ");
2124 } else {
2125 seq_printf(f, "FLOCK ADVISORY ");
2126 }
2127 } else if (IS_LEASE(fl)) {
2128 seq_printf(f, "LEASE ");
2186 if (lease_breaking(fl))
2129 if (fl->fl_type & F_INPROGRESS)
2187 seq_printf(f, "BREAKING ");
2188 else if (fl->fl_file)
2189 seq_printf(f, "ACTIVE ");
2190 else
2191 seq_printf(f, "BREAKER ");
2192 } else {
2193 seq_printf(f, "UNKNOWN UNKNOWN ");
2194 }
2195 if (fl->fl_type & LOCK_MAND) {
2196 seq_printf(f, "%s ",
2197 (fl->fl_type & LOCK_READ)
2198 ? (fl->fl_type & LOCK_WRITE) ? "RW " : "READ "
2199 : (fl->fl_type & LOCK_WRITE) ? "WRITE" : "NONE ");
2200 } else {
2201 seq_printf(f, "%s ",
2130 seq_printf(f, "BREAKING ");
2131 else if (fl->fl_file)
2132 seq_printf(f, "ACTIVE ");
2133 else
2134 seq_printf(f, "BREAKER ");
2135 } else {
2136 seq_printf(f, "UNKNOWN UNKNOWN ");
2137 }
2138 if (fl->fl_type & LOCK_MAND) {
2139 seq_printf(f, "%s ",
2140 (fl->fl_type & LOCK_READ)
2141 ? (fl->fl_type & LOCK_WRITE) ? "RW " : "READ "
2142 : (fl->fl_type & LOCK_WRITE) ? "WRITE" : "NONE ");
2143 } else {
2144 seq_printf(f, "%s ",
2202 (lease_breaking(fl))
2145 (fl->fl_type & F_INPROGRESS)
2203 ? (fl->fl_type & F_UNLCK) ? "UNLCK" : "READ "
2204 : (fl->fl_type & F_WRLCK) ? "WRITE" : "READ ");
2205 }
2206 if (inode) {
2207#ifdef WE_CAN_BREAK_LSLK_NOW
2208 seq_printf(f, "%d %s:%ld ", fl_pid,
2209 inode->i_sb->s_id, inode->i_ino);
2210#else

--- 167 unchanged lines hidden ---
2146 ? (fl->fl_type & F_UNLCK) ? "UNLCK" : "READ "
2147 : (fl->fl_type & F_WRLCK) ? "WRITE" : "READ ");
2148 }
2149 if (inode) {
2150#ifdef WE_CAN_BREAK_LSLK_NOW
2151 seq_printf(f, "%d %s:%ld ", fl_pid,
2152 inode->i_sb->s_id, inode->i_ino);
2153#else

--- 167 unchanged lines hidden ---