Skip to contentSkip to conversation

NFS: Remove a redundant call to unmap_mapping_range()

PATCH In review Trond Myklebust 3 participants 5 messages Jan 29, 2018 – Feb 7, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 NFS: Remove a redundant call to unmap_mapping_range()

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

---
 fs/nfs/inode.c | 1 -
 1 file changed, 1 deletion(-)
fs/nfs/inode.c +0 -1
index deeb7d1097d0..49fba9ea5872 100644
@@ -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;
Signature · 1 line
2.14.3
#1 lore raw

PATCH 2/2 NFS: Fix a race between mmap() and O_DIRECT

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.

---
 fs/nfs/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/io.c +1 -1
index 20fef85d2bb1..9034b4926909 100644
@@ -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);
 	}
 }
 
Signature · 1 line
2.14.3
#2 lore raw
In reply to Trond Myklebust
Quoted 2 lines · Trond Myklebust

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

Quoted 25 lines
---
 fs/nfs/inode.c | 1 -
 1 file changed, 1 deletion(-)
fs/nfs/inode.c +0 -1
index deeb7d1097d0..49fba9ea5872 100644
@@ -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;
Signature · 6 lines
2.14.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
Quoted 6 lines · NeilBrown
Quoted 2 lines · Trond Myklebust

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

Quoted 36 lines

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

Quoted 27 lines
---
 fs/nfs/inode.c | 1 -
 1 file changed, 1 deletion(-)
fs/nfs/inode.c +0 -0
index deeb7d1097d0..49fba9ea5872 100644
@@ -1170,7 +1170,6 @@ static int nfs_invalidate_mapping(struct

inode *inode, struct address_space *map

fs/nfs/inode.c +0 -1
 	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;
Signature · 7 lines
2.14.3

--
To unsubscribe from this list: send the line "unsubscribe linux-
nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, PrimaryData
[email protected]
#4 lore raw
Quoted 9 lines · Trond Myklebust
Quoted 6 lines · NeilBrown
Quoted 2 lines · Trond Myklebust

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

Quoted 41 lines
Quoted 37 lines

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

Quoted 27 lines
---
 fs/nfs/inode.c | 1 -
 1 file changed, 1 deletion(-)
fs/nfs/inode.c +0 -0
index deeb7d1097d0..49fba9ea5872 100644
@@ -1170,7 +1170,6 @@ static int nfs_invalidate_mapping(struct

inode *inode, struct address_space *map

fs/nfs/inode.c +0 -1
 	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;
Signature · 7 lines
2.14.3

--
To unsubscribe from this list: send the line "unsubscribe linux-
nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, PrimaryData
[email protected]