diff options
Diffstat (limited to 'fs/nfs/file.c')
-rw-r--r-- | fs/nfs/file.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 57d3e77d97ee..7a79fbe9f539 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -433,11 +433,7 @@ static int do_unlk(struct file *filp, int cmd, struct file_lock *fl) | |||
433 | * Flush all pending writes before doing anything | 433 | * Flush all pending writes before doing anything |
434 | * with locks.. | 434 | * with locks.. |
435 | */ | 435 | */ |
436 | filemap_fdatawrite(filp->f_mapping); | 436 | nfs_sync_mapping(filp->f_mapping); |
437 | down(&inode->i_sem); | ||
438 | nfs_wb_all(inode); | ||
439 | up(&inode->i_sem); | ||
440 | filemap_fdatawait(filp->f_mapping); | ||
441 | 437 | ||
442 | /* NOTE: special case | 438 | /* NOTE: special case |
443 | * If we're signalled while cleaning up locks on process exit, we | 439 | * If we're signalled while cleaning up locks on process exit, we |
@@ -465,15 +461,8 @@ static int do_setlk(struct file *filp, int cmd, struct file_lock *fl) | |||
465 | * Flush all pending writes before doing anything | 461 | * Flush all pending writes before doing anything |
466 | * with locks.. | 462 | * with locks.. |
467 | */ | 463 | */ |
468 | status = filemap_fdatawrite(filp->f_mapping); | 464 | status = nfs_sync_mapping(filp->f_mapping); |
469 | if (status == 0) { | 465 | if (status != 0) |
470 | down(&inode->i_sem); | ||
471 | status = nfs_wb_all(inode); | ||
472 | up(&inode->i_sem); | ||
473 | if (status == 0) | ||
474 | status = filemap_fdatawait(filp->f_mapping); | ||
475 | } | ||
476 | if (status < 0) | ||
477 | goto out; | 466 | goto out; |
478 | 467 | ||
479 | lock_kernel(); | 468 | lock_kernel(); |
@@ -497,11 +486,7 @@ static int do_setlk(struct file *filp, int cmd, struct file_lock *fl) | |||
497 | * Make sure we clear the cache whenever we try to get the lock. | 486 | * Make sure we clear the cache whenever we try to get the lock. |
498 | * This makes locking act as a cache coherency point. | 487 | * This makes locking act as a cache coherency point. |
499 | */ | 488 | */ |
500 | filemap_fdatawrite(filp->f_mapping); | 489 | nfs_sync_mapping(filp->f_mapping); |
501 | down(&inode->i_sem); | ||
502 | nfs_wb_all(inode); /* we may have slept */ | ||
503 | up(&inode->i_sem); | ||
504 | filemap_fdatawait(filp->f_mapping); | ||
505 | nfs_zap_caches(inode); | 490 | nfs_zap_caches(inode); |
506 | out: | 491 | out: |
507 | rpc_clnt_sigunmask(NFS_CLIENT(inode), &oldset); | 492 | rpc_clnt_sigunmask(NFS_CLIENT(inode), &oldset); |
@@ -524,7 +509,8 @@ static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl) | |||
524 | return -EINVAL; | 509 | return -EINVAL; |
525 | 510 | ||
526 | /* No mandatory locks over NFS */ | 511 | /* No mandatory locks over NFS */ |
527 | if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID) | 512 | if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID && |
513 | fl->fl_type != F_UNLCK) | ||
528 | return -ENOLCK; | 514 | return -ENOLCK; |
529 | 515 | ||
530 | if (IS_GETLK(cmd)) | 516 | if (IS_GETLK(cmd)) |