nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* Unexpected writes seen on a Read-only, DAX enabled EXT4 fs
       [not found] <2036030243.251059.1504977026265.ref@mail.yahoo.com>
@ 2017-09-09 17:10 ` Soccer Liu
  2017-09-11 18:21   ` Ross Zwisler
  0 siblings, 1 reply; 6+ messages in thread
From: Soccer Liu @ 2017-09-09 17:10 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

Hi:
  I was surprised to see a few write operations called into ext4_dax_huge_fault with FAULT_FLAG_WRITE set on vmf->flags
Are those writes expected at all?
static int ext4_dax_huge_fault(struct vm_fault *vmf,
 enum page_entry_size pe_size)
{
...
 bool write = vmf->flags & FAULT_FLAG_WRITE;
Based on the following Mount documentation below, I did mount this ext fs with ro and noloadAre there any other options that I could use to totally eliminate those unexpected writes?
   
   - -r, --read-only
      - Mount the filesystem read-only. A synonym is -o ro.Note that, depending on the filesystem type, state and kernel behavior, the system may still write to the device. For example, Ext3 or ext4 will replay itsjournal if the filesystem is dirty. To prevent this kind of write access, you may want to mount ext3 or ext4 filesystem with "ro,noload" mount options or setthe block device to read-only mode, see command blockdev(8).
      -    

Related DMESG output...

[    0.891653] EXT4-fs (pmem0): DAX enabled. Warning: EXPERIMENTAL, use at your own risk
[    0.892736] EXT4-fs (pmem0): mounted filesystem without journal. Opts: noload,dax
[    0.898293] EXT4-fs (sda): mounted filesystem without journal. Opts: (null)
[    0.902574] random: fast init done
[    0.926157] IPVS: ftp: loaded support on port[0] = 21
// My private debug messages
[    0.997224] EXT4-fs (pmem0): write is 1 handle = 0xffffffffffffffe2 <--read-only device 
[    0.998052] EXT4-fs (pmem0): write is 1 handle = 0xffffffffffffffe2
[    0.998787] EXT4-fs (pmem0): write is 1 handle = 0xffffffffffffffe2
[    0.999720] EXT4-fs (pmem0): write is 0 handle = 0x0
[    1.004626] EXT4-fs (pmem0): write is 0 handle = 0x0
[    1.005359] EXT4-fs (pmem0): write is 0 handle = 0x0
[    1.006128] EXT4-fs (pmem0): write is 0 handle = 0x0
[    1.006824] EXT4-fs (pmem0): write is 0 handle = 0x0
[    1.007499] EXT4-fs (pmem0): write is 0 handle = 0x0
[    1.008149] EXT4-fs (pmem0): write is 0 handle = 0x0
[    7.320626] random: crng init done
[   18.780447] EXT4-fs: 53 callbacks suppressed
[   18.781900] EXT4-fs (pmem0): write is 0 handle = 0x0
[   18.783392] EXT4-fs (pmem0): write is 0 handle = 0x0
[   18.790661] EXT4-fs (pmem0): write is 0 handle = 0x0
[   18.792042] EXT4-fs (pmem0): write is 0 handle = 0x0
[   18.793321] EXT4-fs (pmem0): write is 0 handle = 0x0
[   18.795005] EXT4-fs (pmem0): write is 0 handle = 0x0
[   18.795204] EXT4-fs (pmem0): write is 1 handle = 0xffffffffffffffe2
[   18.795209] EXT4-fs (pmem0): write is 1 handle = 0xffffffffffffffe2
[   18.795213] EXT4-fs (pmem0): write is 1 handle = 0xffffffffffffffe2
[   18.795257] EXT4-fs (pmem0): write is 0 handle = 0x0
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: Unexpected writes seen on a Read-only, DAX enabled EXT4 fs
  2017-09-09 17:10 ` Unexpected writes seen on a Read-only, DAX enabled EXT4 fs Soccer Liu
@ 2017-09-11 18:21   ` Ross Zwisler
  2017-09-11 20:31     ` Andreas Dilger
  2017-09-13 14:48     ` Jan Kara
  0 siblings, 2 replies; 6+ messages in thread
From: Ross Zwisler @ 2017-09-11 18:21 UTC (permalink / raw)
  To: Soccer Liu, linux-ext4; +Cc: linux-nvdimm

On Sat, Sep 09, 2017 at 05:10:26PM +0000, Soccer Liu wrote:
> Hi:
>   I was surprised to see a few write operations called into
> ext4_dax_huge_fault with FAULT_FLAG_WRITE set on vmf->flags
> Are those writes expected at all?
> static int ext4_dax_huge_fault(struct vm_fault *vmf,
>  enum page_entry_size pe_size)
> {
> ...
>  bool write = vmf->flags & FAULT_FLAG_WRITE;
> Based on the following Mount documentation below, I did mount this ext fs
> with ro and noloadAre there any other options that I could use to totally
> eliminate those unexpected writes?
>    
>    - -r, --read-only
>       - Mount the filesystem read-only. A synonym is -o ro.Note that,
>       depending on the filesystem type, state and kernel behavior, the
>       system may still write to the device. For example, Ext3 or ext4 will
>       replay itsjournal if the filesystem is dirty. To prevent this kind of
>       write access, you may want to mount ext3 or ext4 filesystem with
>       "ro,noload" mount options or setthe block device to read-only mode,
>       see command blockdev(8).  -    
> 
> Related DMESG output...
> 
> [    0.891653] EXT4-fs (pmem0): DAX enabled. Warning: EXPERIMENTAL, use at your own risk
> [    0.892736] EXT4-fs (pmem0): mounted filesystem without journal. Opts: noload,dax
> [    0.898293] EXT4-fs (sda): mounted filesystem without journal. Opts: (null)
> [    0.902574] random: fast init done
> [    0.926157] IPVS: ftp: loaded support on port[0] = 21
> // My private debug messages
> [    0.997224] EXT4-fs (pmem0): write is 1 handle = 0xffffffffffffffe2 <--read-only device 
> [    0.998052] EXT4-fs (pmem0): write is 1 handle = 0xffffffffffffffe2
> [    0.998787] EXT4-fs (pmem0): write is 1 handle = 0xffffffffffffffe2
> [    0.999720] EXT4-fs (pmem0): write is 0 handle = 0x0
> [    1.004626] EXT4-fs (pmem0): write is 0 handle = 0x0
> [    1.005359] EXT4-fs (pmem0): write is 0 handle = 0x0
> [    1.006128] EXT4-fs (pmem0): write is 0 handle = 0x0
> [    1.006824] EXT4-fs (pmem0): write is 0 handle = 0x0
> [    1.007499] EXT4-fs (pmem0): write is 0 handle = 0x0
> [    1.008149] EXT4-fs (pmem0): write is 0 handle = 0x0
> [    7.320626] random: crng init done
> [   18.780447] EXT4-fs: 53 callbacks suppressed
> [   18.781900] EXT4-fs (pmem0): write is 0 handle = 0x0
> [   18.783392] EXT4-fs (pmem0): write is 0 handle = 0x0
> [   18.790661] EXT4-fs (pmem0): write is 0 handle = 0x0
> [   18.792042] EXT4-fs (pmem0): write is 0 handle = 0x0
> [   18.793321] EXT4-fs (pmem0): write is 0 handle = 0x0
> [   18.795005] EXT4-fs (pmem0): write is 0 handle = 0x0
> [   18.795204] EXT4-fs (pmem0): write is 1 handle = 0xffffffffffffffe2
> [   18.795209] EXT4-fs (pmem0): write is 1 handle = 0xffffffffffffffe2
> [   18.795213] EXT4-fs (pmem0): write is 1 handle = 0xffffffffffffffe2
> [   18.795257] EXT4-fs (pmem0): write is 0 handle = 0x0

Adding the ext4 list.

I'm pretty sure that this is ext4/mm behavior that is independent of DAX.  DAX
doesn't really have any impact on whether or not write page faults happen on a
RO ext4 filesystem, though this fix from Randy Dodgen:

https://www.spinics.net/lists/linux-ext4/msg58075.html

shows that FAULT_FLAG_WRITE can be set on DAX read-only ext4 mounts when
executing binaries, though in this case the write is going to a COW page.

- Ross
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: Unexpected writes seen on a Read-only, DAX enabled EXT4 fs
  2017-09-11 18:21   ` Ross Zwisler
@ 2017-09-11 20:31     ` Andreas Dilger
  2017-09-12  9:03       ` Simon Ruderich
  2017-09-13 14:48     ` Jan Kara
  1 sibling, 1 reply; 6+ messages in thread
From: Andreas Dilger @ 2017-09-11 20:31 UTC (permalink / raw)
  To: Ross Zwisler; +Cc: Soccer Liu, linux-ext4, linux-nvdimm

[-- Attachment #1: Type: text/plain, Size: 3655 bytes --]

On Sep 11, 2017, at 12:21 PM, Ross Zwisler <ross.zwisler@linux.intel.com> wrote:
> 
> On Sat, Sep 09, 2017 at 05:10:26PM +0000, Soccer Liu wrote:
>> Hi:
>>   I was surprised to see a few write operations called into
>> ext4_dax_huge_fault with FAULT_FLAG_WRITE set on vmf->flags
>> Are those writes expected at all?
>> static int ext4_dax_huge_fault(struct vm_fault *vmf,
>> enum page_entry_size pe_size)
>> {
>> ...
>> bool write = vmf->flags & FAULT_FLAG_WRITE;
>> Based on the following Mount documentation below, I did mount this ext fs
>> with ro and noloadAre there any other options that I could use to totally
>> eliminate those unexpected writes?
>> 
>>   - -r, --read-only
>>      - Mount the filesystem read-only. A synonym is -o ro.Note that,
>>      depending on the filesystem type, state and kernel behavior, the
>>      system may still write to the device. For example, Ext3 or ext4 will
>>      replay itsjournal if the filesystem is dirty. To prevent this kind of
>>      write access, you may want to mount ext3 or ext4 filesystem with
>>      "ro,noload" mount options or setthe block device to read-only mode,
>>      see command blockdev(8).  -
>> 
>> Related DMESG output...
>> 
>> [    0.891653] EXT4-fs (pmem0): DAX enabled. Warning: EXPERIMENTAL, use at your own risk
>> [    0.892736] EXT4-fs (pmem0): mounted filesystem without journal. Opts: noload,dax
>> [    0.898293] EXT4-fs (sda): mounted filesystem without journal. Opts: (null)
>> [    0.902574] random: fast init done
>> [    0.926157] IPVS: ftp: loaded support on port[0] = 21
>> // My private debug messages
>> [    0.997224] EXT4-fs (pmem0): write is 1 handle = 0xffffffffffffffe2 <--read-only device
>> [    0.998052] EXT4-fs (pmem0): write is 1 handle = 0xffffffffffffffe2
>> [    0.998787] EXT4-fs (pmem0): write is 1 handle = 0xffffffffffffffe2
>> [    0.999720] EXT4-fs (pmem0): write is 0 handle = 0x0
>> [    1.004626] EXT4-fs (pmem0): write is 0 handle = 0x0
>> [    1.005359] EXT4-fs (pmem0): write is 0 handle = 0x0
>> [    1.006128] EXT4-fs (pmem0): write is 0 handle = 0x0
>> [    1.006824] EXT4-fs (pmem0): write is 0 handle = 0x0
>> [    1.007499] EXT4-fs (pmem0): write is 0 handle = 0x0
>> [    1.008149] EXT4-fs (pmem0): write is 0 handle = 0x0
>> [    7.320626] random: crng init done
>> [   18.780447] EXT4-fs: 53 callbacks suppressed
>> [   18.781900] EXT4-fs (pmem0): write is 0 handle = 0x0
>> [   18.783392] EXT4-fs (pmem0): write is 0 handle = 0x0
>> [   18.790661] EXT4-fs (pmem0): write is 0 handle = 0x0
>> [   18.792042] EXT4-fs (pmem0): write is 0 handle = 0x0
>> [   18.793321] EXT4-fs (pmem0): write is 0 handle = 0x0
>> [   18.795005] EXT4-fs (pmem0): write is 0 handle = 0x0
>> [   18.795204] EXT4-fs (pmem0): write is 1 handle = 0xffffffffffffffe2
>> [   18.795209] EXT4-fs (pmem0): write is 1 handle = 0xffffffffffffffe2
>> [   18.795213] EXT4-fs (pmem0): write is 1 handle = 0xffffffffffffffe2
>> [   18.795257] EXT4-fs (pmem0): write is 0 handle = 0x0
> 
> Adding the ext4 list.
> 
> I'm pretty sure that this is ext4/mm behavior that is independent of DAX.  DAX
> doesn't really have any impact on whether or not write page faults happen on a
> RO ext4 filesystem, though this fix from Randy Dodgen:
> 
> https://www.spinics.net/lists/linux-ext4/msg58075.html
> 
> shows that FAULT_FLAG_WRITE can be set on DAX read-only ext4 mounts when
> executing binaries, though in this case the write is going to a COW page.

Also, ext4 journal recovery will be done on the filesystem regardless of
whether it is mounted read-only or not.

Cheers, Andreas






[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

* Re: Unexpected writes seen on a Read-only, DAX enabled EXT4 fs
  2017-09-11 20:31     ` Andreas Dilger
@ 2017-09-12  9:03       ` Simon Ruderich
       [not found]         ` <20170912090349.6ow4bv56px2uoqw3-Ezk2jvNqUrNg9hUCZPvPmw@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Ruderich @ 2017-09-12  9:03 UTC (permalink / raw)
  To: Andreas Dilger; +Cc: Ross Zwisler, Soccer Liu, linux-ext4, linux-nvdimm

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

On Mon, Sep 11, 2017 at 02:31:41PM -0600, Andreas Dilger wrote:
> On Sep 11, 2017, at 12:21 PM, Ross Zwisler wrote:
>>
>> On Sat, Sep 09, 2017 at 05:10:26PM +0000, Soccer Liu wrote:
>>> [snip]
>>>
>>> Based on the following Mount documentation below, I did mount this ext fs
>>> with ro and noloadAre there any other options that I could use to totally
>>> eliminate those unexpected writes?
>
> [snip]
>
> Also, ext4 journal recovery will be done on the filesystem regardless of
> whether it is mounted read-only or not.

I thought the noload option should prevent journal recovery and
thus be truly read-only. At least it worked on a read-only device
for me.

Regards
Simon
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: Unexpected writes seen on a Read-only, DAX enabled EXT4 fs
  2017-09-11 18:21   ` Ross Zwisler
  2017-09-11 20:31     ` Andreas Dilger
@ 2017-09-13 14:48     ` Jan Kara
  1 sibling, 0 replies; 6+ messages in thread
From: Jan Kara @ 2017-09-13 14:48 UTC (permalink / raw)
  To: Ross Zwisler; +Cc: linux-ext4, linux-nvdimm

On Mon 11-09-17 12:21:12, Ross Zwisler wrote:
> On Sat, Sep 09, 2017 at 05:10:26PM +0000, Soccer Liu wrote:
> > Hi:
> >   I was surprised to see a few write operations called into
> > ext4_dax_huge_fault with FAULT_FLAG_WRITE set on vmf->flags
> > Are those writes expected at all?
> > static int ext4_dax_huge_fault(struct vm_fault *vmf,
> >  enum page_entry_size pe_size)
> > {
> > ...
> >  bool write = vmf->flags & FAULT_FLAG_WRITE;
> > Based on the following Mount documentation below, I did mount this ext fs
> > with ro and noloadAre there any other options that I could use to totally
> > eliminate those unexpected writes?

Well, I expect these are actually 4KB faults into private mapping (they
would end up using ext4_dax_huge_fault() as well) and the fix Ross
references below should fix that... But please tell if it does not (along
with a reproducer). Thanks!

> Adding the ext4 list.
> 
> I'm pretty sure that this is ext4/mm behavior that is independent of DAX.  DAX
> doesn't really have any impact on whether or not write page faults happen on a
> RO ext4 filesystem, though this fix from Randy Dodgen:
> 
> https://www.spinics.net/lists/linux-ext4/msg58075.html
> 
> shows that FAULT_FLAG_WRITE can be set on DAX read-only ext4 mounts when
> executing binaries, though in this case the write is going to a COW page.

								Honza

-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: Unexpected writes seen on a Read-only, DAX enabled EXT4 fs
       [not found]         ` <20170912090349.6ow4bv56px2uoqw3-Ezk2jvNqUrNg9hUCZPvPmw@public.gmane.org>
@ 2017-09-15  0:45           ` Soccer Liu
  0 siblings, 0 replies; 6+ messages in thread
From: Soccer Liu @ 2017-09-15  0:45 UTC (permalink / raw)
  To: Simon Ruderich, Andreas Dilger
  Cc: linux-ext4-u79uwXL29TY76Z2rM5mHXA, linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

Thanks for the replies.
After some diggings, I found the writes that I was seeing was for not the real writes, instead they are those COW writes mentioned in the following commit.
"ext4: fix fault handling when mounted with -o dax,ro "https://github.com/torvalds/linux/commit/fd96b8da68d32a9403726db09b229f4b5ac849c7#diff-f959e50cbd17809e773ef7b89a38d3ca
I was hitting this exactly issue on DAX enabled readonly emulated PMEM devices. (a regression from https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?h=linux-4.11.y&id=5a3651b4a92cbc5230d67d2ce87fb3f7373c7665 )
With above  fix, it's all good now.
ThanksCheng-mean
 

    On Tuesday, September 12, 2017 2:03 AM, Simon Ruderich <simon@ruderich.org> wrote:
 

 On Mon, Sep 11, 2017 at 02:31:41PM -0600, Andreas Dilger wrote:
> On Sep 11, 2017, at 12:21 PM, Ross Zwisler wrote:
>>
>> On Sat, Sep 09, 2017 at 05:10:26PM +0000, Soccer Liu wrote:
>>> [snip]
>>>
>>> Based on the following Mount documentation below, I did mount this ext fs
>>> with ro and noloadAre there any other options that I could use to totally
>>> eliminate those unexpected writes?
>
> [snip]
>
> Also, ext4 journal recovery will be done on the filesystem regardless of
> whether it is mounted read-only or not.

I thought the noload option should prevent journal recovery and
thus be truly read-only. At least it worked on a read-only device
for me.

Regards
Simon
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

   
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

end of thread, other threads:[~2017-09-15  0:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <2036030243.251059.1504977026265.ref@mail.yahoo.com>
2017-09-09 17:10 ` Unexpected writes seen on a Read-only, DAX enabled EXT4 fs Soccer Liu
2017-09-11 18:21   ` Ross Zwisler
2017-09-11 20:31     ` Andreas Dilger
2017-09-12  9:03       ` Simon Ruderich
     [not found]         ` <20170912090349.6ow4bv56px2uoqw3-Ezk2jvNqUrNg9hUCZPvPmw@public.gmane.org>
2017-09-15  0:45           ` Soccer Liu
2017-09-13 14:48     ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).