linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] NFS: Remove a redundant call to unmap_mapping_range()
@ 2018-01-29  2:58 Trond Myklebust
  2018-01-29  2:58 ` [PATCH 2/2] NFS: Fix a race between mmap() and O_DIRECT Trond Myklebust
  2018-02-07  6:42 ` [PATCH 1/2] NFS: Remove a redundant call to unmap_mapping_range() NeilBrown
  0 siblings, 2 replies; 5+ messages in thread
From: Trond Myklebust @ 2018-01-29  2:58 UTC (permalink / raw)
  To: linux-nfs

We don't need to call unmap_mapping_range() prior to calling
nfs_sync_mapping().

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
 fs/nfs/inode.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index deeb7d1097d0..49fba9ea5872 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1170,7 +1170,6 @@ static int nfs_invalidate_mapping(struct inode *inode, struct address_space *map
 
 	if (mapping->nrpages != 0) {
 		if (S_ISREG(inode->i_mode)) {
-			unmap_mapping_range(mapping, 0, 0, 0);
 			ret = nfs_sync_mapping(mapping);
 			if (ret < 0)
 				return ret;
-- 
2.14.3


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

* [PATCH 2/2] NFS: Fix a race between mmap() and O_DIRECT
  2018-01-29  2:58 [PATCH 1/2] NFS: Remove a redundant call to unmap_mapping_range() Trond Myklebust
@ 2018-01-29  2:58 ` Trond Myklebust
  2018-02-07  6:42 ` [PATCH 1/2] NFS: Remove a redundant call to unmap_mapping_range() NeilBrown
  1 sibling, 0 replies; 5+ messages in thread
From: Trond Myklebust @ 2018-01-29  2:58 UTC (permalink / raw)
  To: linux-nfs

When locking the file in order to do O_DIRECT on it, we must unmap
any mmapped ranges on the pagecache so that we can flush out the
dirty data.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: stable@vger.kernel.org # v4.8+
---
 fs/nfs/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/io.c b/fs/nfs/io.c
index 20fef85d2bb1..9034b4926909 100644
--- a/fs/nfs/io.c
+++ b/fs/nfs/io.c
@@ -99,7 +99,7 @@ static void nfs_block_buffered(struct nfs_inode *nfsi, struct inode *inode)
 {
 	if (!test_bit(NFS_INO_ODIRECT, &nfsi->flags)) {
 		set_bit(NFS_INO_ODIRECT, &nfsi->flags);
-		nfs_wb_all(inode);
+		nfs_sync_mapping(inode->i_mapping);
 	}
 }
 
-- 
2.14.3


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

* Re: [PATCH 1/2] NFS: Remove a redundant call to unmap_mapping_range()
  2018-01-29  2:58 [PATCH 1/2] NFS: Remove a redundant call to unmap_mapping_range() Trond Myklebust
  2018-01-29  2:58 ` [PATCH 2/2] NFS: Fix a race between mmap() and O_DIRECT Trond Myklebust
@ 2018-02-07  6:42 ` NeilBrown
  2018-02-07 11:46   ` Trond Myklebust
  1 sibling, 1 reply; 5+ messages in thread
From: NeilBrown @ 2018-02-07  6:42 UTC (permalink / raw)
  To: Trond Myklebust, linux-nfs

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

On Sun, Jan 28 2018, Trond Myklebust wrote:

> We don't need to call unmap_mapping_range() prior to calling
> nfs_sync_mapping().

Don't we?
Doesn't that allow a process which mapped the page to dirty it
immediately after nfs_sync_mapping(), without the page being
reloaded from the server first?
Doesn't seem right..

Thanks,
NeilBrown


>
> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
> ---
>  fs/nfs/inode.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
> index deeb7d1097d0..49fba9ea5872 100644
> --- a/fs/nfs/inode.c
> +++ b/fs/nfs/inode.c
> @@ -1170,7 +1170,6 @@ static int nfs_invalidate_mapping(struct inode *inode, struct address_space *map
>  
>  	if (mapping->nrpages != 0) {
>  		if (S_ISREG(inode->i_mode)) {
> -			unmap_mapping_range(mapping, 0, 0, 0);
>  			ret = nfs_sync_mapping(mapping);
>  			if (ret < 0)
>  				return ret;
> -- 
> 2.14.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

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

* Re: [PATCH 1/2] NFS: Remove a redundant call to unmap_mapping_range()
  2018-02-07  6:42 ` [PATCH 1/2] NFS: Remove a redundant call to unmap_mapping_range() NeilBrown
@ 2018-02-07 11:46   ` Trond Myklebust
  2018-02-07 21:20     ` NeilBrown
  0 siblings, 1 reply; 5+ messages in thread
From: Trond Myklebust @ 2018-02-07 11:46 UTC (permalink / raw)
  To: neilb@suse.com, linux-nfs@vger.kernel.org

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

On Wed, 2018-02-07 at 17:42 +1100, NeilBrown wrote:
> On Sun, Jan 28 2018, Trond Myklebust wrote:
> 
> > We don't need to call unmap_mapping_range() prior to calling
> > nfs_sync_mapping().
> 
> Don't we?

See line 2 of nfs_sync_mapping(). ☺

> Doesn't that allow a process which mapped the page to dirty it
> immediately after nfs_sync_mapping(), without the page being
> reloaded from the server first?
> Doesn't seem right..
> 
> Thanks,
> NeilBrown
> 
> 
> > 
> > Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
> > ---
> >  fs/nfs/inode.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
> > index deeb7d1097d0..49fba9ea5872 100644
> > --- a/fs/nfs/inode.c
> > +++ b/fs/nfs/inode.c
> > @@ -1170,7 +1170,6 @@ static int nfs_invalidate_mapping(struct
> > inode *inode, struct address_space *map
> >  
> >  	if (mapping->nrpages != 0) {
> >  		if (S_ISREG(inode->i_mode)) {
> > -			unmap_mapping_range(mapping, 0, 0, 0);
> >  			ret = nfs_sync_mapping(mapping);
> >  			if (ret < 0)
> >  				return ret;
> > -- 
> > 2.14.3
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-
> > nfs" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Trond Myklebust
Linux NFS client maintainer, PrimaryData
trond.myklebust@primarydata.com

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 1/2] NFS: Remove a redundant call to unmap_mapping_range()
  2018-02-07 11:46   ` Trond Myklebust
@ 2018-02-07 21:20     ` NeilBrown
  0 siblings, 0 replies; 5+ messages in thread
From: NeilBrown @ 2018-02-07 21:20 UTC (permalink / raw)
  To: Trond Myklebust, linux-nfs@vger.kernel.org

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

On Wed, Feb 07 2018, Trond Myklebust wrote:

> On Wed, 2018-02-07 at 17:42 +1100, NeilBrown wrote:
>> On Sun, Jan 28 2018, Trond Myklebust wrote:
>> 
>> > We don't need to call unmap_mapping_range() prior to calling
>> > nfs_sync_mapping().
>> 
>> Don't we?
>
> See line 2 of nfs_sync_mapping(). ☺

Ahhh.  Makes perfect sense now - thanks

NeilBrown


>
>> Doesn't that allow a process which mapped the page to dirty it
>> immediately after nfs_sync_mapping(), without the page being
>> reloaded from the server first?
>> Doesn't seem right..
>> 
>> Thanks,
>> NeilBrown
>> 
>> 
>> > 
>> > Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
>> > ---
>> >  fs/nfs/inode.c | 1 -
>> >  1 file changed, 1 deletion(-)
>> > 
>> > diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
>> > index deeb7d1097d0..49fba9ea5872 100644
>> > --- a/fs/nfs/inode.c
>> > +++ b/fs/nfs/inode.c
>> > @@ -1170,7 +1170,6 @@ static int nfs_invalidate_mapping(struct
>> > inode *inode, struct address_space *map
>> >  
>> >  	if (mapping->nrpages != 0) {
>> >  		if (S_ISREG(inode->i_mode)) {
>> > -			unmap_mapping_range(mapping, 0, 0, 0);
>> >  			ret = nfs_sync_mapping(mapping);
>> >  			if (ret < 0)
>> >  				return ret;
>> > -- 
>> > 2.14.3
>> > 
>> > --
>> > To unsubscribe from this list: send the line "unsubscribe linux-
>> > nfs" in
>> > the body of a message to majordomo@vger.kernel.org
>> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> -- 
> Trond Myklebust
> Linux NFS client maintainer, PrimaryData
> trond.myklebust@primarydata.com

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

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

end of thread, other threads:[~2018-02-07 21:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-29  2:58 [PATCH 1/2] NFS: Remove a redundant call to unmap_mapping_range() Trond Myklebust
2018-01-29  2:58 ` [PATCH 2/2] NFS: Fix a race between mmap() and O_DIRECT Trond Myklebust
2018-02-07  6:42 ` [PATCH 1/2] NFS: Remove a redundant call to unmap_mapping_range() NeilBrown
2018-02-07 11:46   ` Trond Myklebust
2018-02-07 21:20     ` NeilBrown

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).