diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-09-19 16:10:53 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-09-19 16:10:53 -0400 |
| commit | 46be7b73e82453447cd97b3440d523159eab09f8 (patch) | |
| tree | b54c7a44f475e2bfed4b80331cbb836b77e096eb | |
| parent | 81770f41447bb2534d29b58a14ab501c0fb1e671 (diff) | |
| parent | 0f23ae74f589304bf33233f85737f4fd368549eb (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull btrfs fixes from Chris Mason:
"I've got a revert to fix a regression with btrfs device registration,
and Filipe has part two of his fsync fix from last week"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
Revert "Btrfs: device_list_add() should not update list when mounted"
Btrfs: set inode's logged_trans/last_log_commit after ranged fsync
| -rw-r--r-- | fs/btrfs/btrfs_inode.h | 13 | ||||
| -rw-r--r-- | fs/btrfs/tree-log.c | 14 | ||||
| -rw-r--r-- | fs/btrfs/volumes.c | 13 |
3 files changed, 19 insertions, 21 deletions
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 43527fd78825..56b8522d5767 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h | |||
| @@ -234,8 +234,17 @@ static inline int btrfs_inode_in_log(struct inode *inode, u64 generation) | |||
| 234 | BTRFS_I(inode)->last_sub_trans <= | 234 | BTRFS_I(inode)->last_sub_trans <= |
| 235 | BTRFS_I(inode)->last_log_commit && | 235 | BTRFS_I(inode)->last_log_commit && |
| 236 | BTRFS_I(inode)->last_sub_trans <= | 236 | BTRFS_I(inode)->last_sub_trans <= |
| 237 | BTRFS_I(inode)->root->last_log_commit) | 237 | BTRFS_I(inode)->root->last_log_commit) { |
| 238 | return 1; | 238 | /* |
| 239 | * After a ranged fsync we might have left some extent maps | ||
| 240 | * (that fall outside the fsync's range). So return false | ||
| 241 | * here if the list isn't empty, to make sure btrfs_log_inode() | ||
| 242 | * will be called and process those extent maps. | ||
| 243 | */ | ||
| 244 | smp_mb(); | ||
| 245 | if (list_empty(&BTRFS_I(inode)->extent_tree.modified_extents)) | ||
| 246 | return 1; | ||
| 247 | } | ||
| 239 | return 0; | 248 | return 0; |
| 240 | } | 249 | } |
| 241 | 250 | ||
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index d296efe2d3e7..1d1ba083ca6e 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
| @@ -4093,18 +4093,8 @@ log_extents: | |||
| 4093 | } | 4093 | } |
| 4094 | } | 4094 | } |
| 4095 | 4095 | ||
| 4096 | write_lock(&em_tree->lock); | 4096 | BTRFS_I(inode)->logged_trans = trans->transid; |
| 4097 | /* | 4097 | BTRFS_I(inode)->last_log_commit = BTRFS_I(inode)->last_sub_trans; |
| 4098 | * If we're doing a ranged fsync and there are still modified extents | ||
| 4099 | * in the list, we must run on the next fsync call as it might cover | ||
| 4100 | * those extents (a full fsync or an fsync for other range). | ||
| 4101 | */ | ||
| 4102 | if (list_empty(&em_tree->modified_extents)) { | ||
| 4103 | BTRFS_I(inode)->logged_trans = trans->transid; | ||
| 4104 | BTRFS_I(inode)->last_log_commit = | ||
| 4105 | BTRFS_I(inode)->last_sub_trans; | ||
| 4106 | } | ||
| 4107 | write_unlock(&em_tree->lock); | ||
| 4108 | out_unlock: | 4098 | out_unlock: |
| 4109 | if (unlikely(err)) | 4099 | if (unlikely(err)) |
| 4110 | btrfs_put_logged_extents(&logged_list); | 4100 | btrfs_put_logged_extents(&logged_list); |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 340a92d08e84..2c2d6d1d8eee 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
| @@ -529,12 +529,12 @@ static noinline int device_list_add(const char *path, | |||
| 529 | */ | 529 | */ |
| 530 | 530 | ||
| 531 | /* | 531 | /* |
| 532 | * As of now don't allow update to btrfs_fs_device through | 532 | * For now, we do allow update to btrfs_fs_device through the |
| 533 | * the btrfs dev scan cli, after FS has been mounted. | 533 | * btrfs dev scan cli after FS has been mounted. We're still |
| 534 | * tracking a problem where systems fail mount by subvolume id | ||
| 535 | * when we reject replacement on a mounted FS. | ||
| 534 | */ | 536 | */ |
| 535 | if (fs_devices->opened) { | 537 | if (!fs_devices->opened && found_transid < device->generation) { |
| 536 | return -EBUSY; | ||
| 537 | } else { | ||
| 538 | /* | 538 | /* |
| 539 | * That is if the FS is _not_ mounted and if you | 539 | * That is if the FS is _not_ mounted and if you |
| 540 | * are here, that means there is more than one | 540 | * are here, that means there is more than one |
| @@ -542,8 +542,7 @@ static noinline int device_list_add(const char *path, | |||
| 542 | * with larger generation number or the last-in if | 542 | * with larger generation number or the last-in if |
| 543 | * generation are equal. | 543 | * generation are equal. |
| 544 | */ | 544 | */ |
| 545 | if (found_transid < device->generation) | 545 | return -EEXIST; |
| 546 | return -EEXIST; | ||
| 547 | } | 546 | } |
| 548 | 547 | ||
| 549 | name = rcu_string_strdup(path, GFP_NOFS); | 548 | name = rcu_string_strdup(path, GFP_NOFS); |
