diff options
| -rw-r--r-- | fs/ceph/caps.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 37a42353b983..11631c4c7d14 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
| @@ -1561,7 +1561,19 @@ retry_locked: | |||
| 1561 | if (!mdsc->stopping && inode->i_nlink > 0) { | 1561 | if (!mdsc->stopping && inode->i_nlink > 0) { |
| 1562 | if (want) { | 1562 | if (want) { |
| 1563 | retain |= CEPH_CAP_ANY; /* be greedy */ | 1563 | retain |= CEPH_CAP_ANY; /* be greedy */ |
| 1564 | } else if (S_ISDIR(inode->i_mode) && | ||
| 1565 | (issued & CEPH_CAP_FILE_SHARED) && | ||
| 1566 | __ceph_dir_is_complete(ci)) { | ||
| 1567 | /* | ||
| 1568 | * If a directory is complete, we want to keep | ||
| 1569 | * the exclusive cap. So that MDS does not end up | ||
| 1570 | * revoking the shared cap on every create/unlink | ||
| 1571 | * operation. | ||
| 1572 | */ | ||
| 1573 | want = CEPH_CAP_ANY_SHARED | CEPH_CAP_FILE_EXCL; | ||
| 1574 | retain |= want; | ||
| 1564 | } else { | 1575 | } else { |
| 1576 | |||
| 1565 | retain |= CEPH_CAP_ANY_SHARED; | 1577 | retain |= CEPH_CAP_ANY_SHARED; |
| 1566 | /* | 1578 | /* |
| 1567 | * keep RD only if we didn't have the file open RW, | 1579 | * keep RD only if we didn't have the file open RW, |
