All of lore.kernel.org
 help / color / mirror / Atom feed
* Unexpected behavior involving file attributes and snapshots.
@ 2017-02-14 15:30 Austin S. Hemmelgarn
  2017-02-14 15:55 ` Roman Mamedov
  2017-02-14 16:07 ` Chris Murphy
  0 siblings, 2 replies; 5+ messages in thread
From: Austin S. Hemmelgarn @ 2017-02-14 15:30 UTC (permalink / raw)
  To: linux-btrfs

I was just experimenting with snapshots on 4.9.0, and came across some 
unexpected behavior.

The simple explanation is that if you snapshot a subvolume, any files in 
the subvolume that have the NOCOW attribute will not have that attribute 
in the snapshot.  Some further testing indicates that this is the only 
file attribute that isn't preserved (I checked all the chattr flags that 
BTRFS supports).

I'm kind of curious whether:
1. This is actually documented somewhere, as it's somewhat unexpected 
given that everything else is preserved when snapshotting.
2. This is intended behavior, or just happens to be a side effect of the 
implementation.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unexpected behavior involving file attributes and snapshots.
  2017-02-14 15:30 Unexpected behavior involving file attributes and snapshots Austin S. Hemmelgarn
@ 2017-02-14 15:55 ` Roman Mamedov
  2017-02-14 16:07 ` Chris Murphy
  1 sibling, 0 replies; 5+ messages in thread
From: Roman Mamedov @ 2017-02-14 15:55 UTC (permalink / raw)
  To: Austin S. Hemmelgarn; +Cc: linux-btrfs

On Tue, 14 Feb 2017 10:30:43 -0500
"Austin S. Hemmelgarn" <ahferroin7@gmail.com> wrote:

> I was just experimenting with snapshots on 4.9.0, and came across some 
> unexpected behavior.
> 
> The simple explanation is that if you snapshot a subvolume, any files in 
> the subvolume that have the NOCOW attribute will not have that attribute 
> in the snapshot.  Some further testing indicates that this is the only 
> file attribute that isn't preserved (I checked all the chattr flags that 
> BTRFS supports).
> 
> I'm kind of curious whether:
> 1. This is actually documented somewhere, as it's somewhat unexpected 
> given that everything else is preserved when snapshotting.
> 2. This is intended behavior, or just happens to be a side effect of the 
> implementation.

I don't seem to get this on 4.4.45 and 4.4.47.

$ btrfs sub create test
Create subvolume './test'
$ touch test/abc
$ chattr +C test/abc 
$ echo def > test/abc
$ ls -la test/abc 
-rw-r--r-- 1 rm rm 4 Feb 14 20:52 test/abc
$ lsattr test/abc 
---------------C test/abc
$ btrfs sub snap test test2
Create a snapshot of 'test' in './test2'
$ ls -la test2/abc 
-rw-r--r-- 1 rm rm 4 Feb 14 20:52 test2/abc
$ lsattr test2/abc 
---------------C test2/abc

-- 
With respect,
Roman

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unexpected behavior involving file attributes and snapshots.
  2017-02-14 15:30 Unexpected behavior involving file attributes and snapshots Austin S. Hemmelgarn
  2017-02-14 15:55 ` Roman Mamedov
@ 2017-02-14 16:07 ` Chris Murphy
  2017-02-14 16:46   ` Austin S. Hemmelgarn
  1 sibling, 1 reply; 5+ messages in thread
From: Chris Murphy @ 2017-02-14 16:07 UTC (permalink / raw)
  To: Austin S. Hemmelgarn; +Cc: Btrfs BTRFS

On Tue, Feb 14, 2017 at 8:30 AM, Austin S. Hemmelgarn
<ahferroin7@gmail.com> wrote:
> I was just experimenting with snapshots on 4.9.0, and came across some
> unexpected behavior.
>
> The simple explanation is that if you snapshot a subvolume, any files in the
> subvolume that have the NOCOW attribute will not have that attribute in the
> snapshot.  Some further testing indicates that this is the only file
> attribute that isn't preserved (I checked all the chattr flags that BTRFS
> supports).

Huh, I can't reproduce this with 4.9.8 or 4.10rc7. systemd sets
journal files with chattr +C, and I do manual snapshots of rootfs
periodically, and those snapshots have journal files that have +C
still set.


-- 
Chris Murphy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unexpected behavior involving file attributes and snapshots.
  2017-02-14 16:07 ` Chris Murphy
@ 2017-02-14 16:46   ` Austin S. Hemmelgarn
  2017-02-14 17:52     ` Austin S. Hemmelgarn
  0 siblings, 1 reply; 5+ messages in thread
From: Austin S. Hemmelgarn @ 2017-02-14 16:46 UTC (permalink / raw)
  Cc: Btrfs BTRFS

On 2017-02-14 11:07, Chris Murphy wrote:
> On Tue, Feb 14, 2017 at 8:30 AM, Austin S. Hemmelgarn
> <ahferroin7@gmail.com> wrote:
>> I was just experimenting with snapshots on 4.9.0, and came across some
>> unexpected behavior.
>>
>> The simple explanation is that if you snapshot a subvolume, any files in the
>> subvolume that have the NOCOW attribute will not have that attribute in the
>> snapshot.  Some further testing indicates that this is the only file
>> attribute that isn't preserved (I checked all the chattr flags that BTRFS
>> supports).
>
> Huh, I can't reproduce this with 4.9.8 or 4.10rc7. systemd sets
> journal files with chattr +C, and I do manual snapshots of rootfs
> periodically, and those snapshots have journal files that have +C
> still set.
>
Just tested on a different filesystem, and I'm not seeing it there 
either, I'll take a closer look at the FS I saw this on and see if I can 
figure out what's up.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unexpected behavior involving file attributes and snapshots.
  2017-02-14 16:46   ` Austin S. Hemmelgarn
@ 2017-02-14 17:52     ` Austin S. Hemmelgarn
  0 siblings, 0 replies; 5+ messages in thread
From: Austin S. Hemmelgarn @ 2017-02-14 17:52 UTC (permalink / raw)
  To: Btrfs BTRFS

On 2017-02-14 11:46, Austin S. Hemmelgarn wrote:
> On 2017-02-14 11:07, Chris Murphy wrote:
>> On Tue, Feb 14, 2017 at 8:30 AM, Austin S. Hemmelgarn
>> <ahferroin7@gmail.com> wrote:
>>> I was just experimenting with snapshots on 4.9.0, and came across some
>>> unexpected behavior.
>>>
>>> The simple explanation is that if you snapshot a subvolume, any files
>>> in the
>>> subvolume that have the NOCOW attribute will not have that attribute
>>> in the
>>> snapshot.  Some further testing indicates that this is the only file
>>> attribute that isn't preserved (I checked all the chattr flags that
>>> BTRFS
>>> supports).
>>
>> Huh, I can't reproduce this with 4.9.8 or 4.10rc7. systemd sets
>> journal files with chattr +C, and I do manual snapshots of rootfs
>> periodically, and those snapshots have journal files that have +C
>> still set.
>>
> Just tested on a different filesystem, and I'm not seeing it there
> either, I'll take a closer look at the FS I saw this on and see if I can
> figure out what's up.
>
After poking around a bit further, the system crashed, and it looks like 
there was some memory corruption scattered throughout the kernel from 
one of the other modules I had loaded (now I get to spend a day or more 
figuring out which one and reporting that bug).  Given the state of the 
kernel crash dump though, I'm actually somewhat surprised that things 
weren't misbehaving more spectacularly than this.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-02-14 17:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-14 15:30 Unexpected behavior involving file attributes and snapshots Austin S. Hemmelgarn
2017-02-14 15:55 ` Roman Mamedov
2017-02-14 16:07 ` Chris Murphy
2017-02-14 16:46   ` Austin S. Hemmelgarn
2017-02-14 17:52     ` Austin S. Hemmelgarn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.