[1/2] NFS: Remove a redundant call to unmap_mapping_range()
diff mbox

Message ID 20180129025822.5116-1-trond.myklebust@primarydata.com
State New
Headers show

Commit Message

Trond Myklebust Jan. 29, 2018, 2:58 a.m. UTC
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(-)

Comments

NeilBrown Feb. 7, 2018, 6:42 a.m. UTC | #1
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
Trond Myklebust Feb. 7, 2018, 11:46 a.m. UTC | #2
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
NeilBrown Feb. 7, 2018, 9:20 p.m. UTC | #3
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

Patch
diff mbox

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;