Message ID | 20170103210045.GA4651@localhost.localdomain (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 4175987..4eace1a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1752,7 +1752,12 @@ static void btrfs_set_bit_hook(struct inode *inode, bool do_list = !btrfs_is_free_space_inode(inode); if (*bits & EXTENT_FIRST_DELALLOC) { - *bits &= ~EXTENT_FIRST_DELALLOC; + /* + * With EXTENT_UPTODATE, the state gets rewritten + * before writing it back, or gets read from disk. + */ + if (!(state->state & EXTENT_UPTODATE)) + *bits &= ~EXTENT_FIRST_DELALLOC; } else { spin_lock(&BTRFS_I(inode)->lock); BTRFS_I(inode)->outstanding_extents++;