* [PATCH v4 1/4] fs/9p: remove unnecessary and overrestrictive check
2023-07-19 16:22 [PATCH v4 0/4] fs/9p: fix mmap regression Eric Van Hensbergen
@ 2023-07-19 16:22 ` Eric Van Hensbergen
2023-07-19 16:22 ` [PATCH v4 2/4] fs/9p: fix typo in comparison logic for cache mode Eric Van Hensbergen
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Eric Van Hensbergen @ 2023-07-19 16:22 UTC (permalink / raw)
To: Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck
Cc: v9fs, linux-kernel, kernel, stable, Robert Schwebel, Eric Van Hensbergen
This eliminates a check for shared that was overrestrictive and
prevented read-only mmaps when writeback caches weren't enabled.
Cc: stable@vger.kernel.org
Fixes: 1543b4c5071c ("fs/9p: remove writeback fid and fix per-file modes")
Reported-by: Robert Schwebel <r.schwebel@pengutronix.de>
Closes: https://lore.kernel.org/v9fs/ZK25XZ%2BGpR3KHIB%2F@pengutronix.de
Reviewed-by: Dominique Martinet <asmadeus@codewreck.org>
Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com>
Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org>
---
fs/9p/vfs_file.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 2996fb00387f..9b61b480a9b0 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -505,9 +505,7 @@ v9fs_file_mmap(struct file *filp, struct vm_area_struct *vma)
p9_debug(P9_DEBUG_MMAP, "filp :%p\n", filp);
if (!(v9ses->cache & CACHE_WRITEBACK)) {
- p9_debug(P9_DEBUG_CACHE, "(no mmap mode)");
- if (vma->vm_flags & VM_MAYSHARE)
- return -ENODEV;
+ p9_debug(P9_DEBUG_CACHE, "(read-only mmap mode)");
invalidate_inode_pages2(filp->f_mapping);
return generic_file_readonly_mmap(filp, vma);
}
--
2.39.2
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v4 2/4] fs/9p: fix typo in comparison logic for cache mode
2023-07-19 16:22 [PATCH v4 0/4] fs/9p: fix mmap regression Eric Van Hensbergen
2023-07-19 16:22 ` [PATCH v4 1/4] fs/9p: remove unnecessary and overrestrictive check Eric Van Hensbergen
@ 2023-07-19 16:22 ` Eric Van Hensbergen
2023-07-19 16:22 ` [PATCH v4 3/4] fs/9p: fix type mismatch in file cache mode helper Eric Van Hensbergen
2023-07-19 16:22 ` [PATCH v4 4/4] fs/9p: remove unnecessary invalidate_inode_pages2 Eric Van Hensbergen
3 siblings, 0 replies; 5+ messages in thread
From: Eric Van Hensbergen @ 2023-07-19 16:22 UTC (permalink / raw)
To: Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck
Cc: v9fs, linux-kernel, kernel, stable, Robert Schwebel, Eric Van Hensbergen
There appears to be a typo in the comparison statement for the logic
which sets a file's cache mode based on mount flags.
Cc: stable@vger.kernel.org
Fixes: 1543b4c5071c ("fs/9p: remove writeback fid and fix per-file modes")
Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com>
Reviewed-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org>
---
fs/9p/fid.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/9p/fid.h b/fs/9p/fid.h
index 0c51889a60b3..297c2c377e3d 100644
--- a/fs/9p/fid.h
+++ b/fs/9p/fid.h
@@ -57,7 +57,7 @@ static inline void v9fs_fid_add_modes(struct p9_fid *fid, int s_flags,
(s_flags & V9FS_DIRECT_IO) || (f_flags & O_DIRECT)) {
fid->mode |= P9L_DIRECT; /* no read or write cache */
} else if ((!(s_cache & CACHE_WRITEBACK)) ||
- (f_flags & O_DSYNC) | (s_flags & V9FS_SYNC)) {
+ (f_flags & O_DSYNC) || (s_flags & V9FS_SYNC)) {
fid->mode |= P9L_NOWRITECACHE;
}
}
--
2.39.2
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v4 3/4] fs/9p: fix type mismatch in file cache mode helper
2023-07-19 16:22 [PATCH v4 0/4] fs/9p: fix mmap regression Eric Van Hensbergen
2023-07-19 16:22 ` [PATCH v4 1/4] fs/9p: remove unnecessary and overrestrictive check Eric Van Hensbergen
2023-07-19 16:22 ` [PATCH v4 2/4] fs/9p: fix typo in comparison logic for cache mode Eric Van Hensbergen
@ 2023-07-19 16:22 ` Eric Van Hensbergen
2023-07-19 16:22 ` [PATCH v4 4/4] fs/9p: remove unnecessary invalidate_inode_pages2 Eric Van Hensbergen
3 siblings, 0 replies; 5+ messages in thread
From: Eric Van Hensbergen @ 2023-07-19 16:22 UTC (permalink / raw)
To: Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck
Cc: v9fs, linux-kernel, kernel, stable, Robert Schwebel, Eric Van Hensbergen
There were two flags (s_flags and s_cache) which had incorrect signed
type in the parameters of the file cache mode helper function.
Cc: stable@vger.kernel.org
Fixes: 1543b4c5071c ("fs/9p: remove writeback fid and fix per-file modes")
Reviewed-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org>
---
fs/9p/fid.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/9p/fid.h b/fs/9p/fid.h
index 297c2c377e3d..29281b7c3887 100644
--- a/fs/9p/fid.h
+++ b/fs/9p/fid.h
@@ -46,8 +46,8 @@ static inline struct p9_fid *v9fs_fid_clone(struct dentry *dentry)
* NOTE: these are set after open so only reflect 9p client not
* underlying file system on server.
*/
-static inline void v9fs_fid_add_modes(struct p9_fid *fid, int s_flags,
- int s_cache, unsigned int f_flags)
+static inline void v9fs_fid_add_modes(struct p9_fid *fid, unsigned int s_flags,
+ unsigned int s_cache, unsigned int f_flags)
{
if (fid->qid.type != P9_QTFILE)
return;
--
2.39.2
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v4 4/4] fs/9p: remove unnecessary invalidate_inode_pages2
2023-07-19 16:22 [PATCH v4 0/4] fs/9p: fix mmap regression Eric Van Hensbergen
` (2 preceding siblings ...)
2023-07-19 16:22 ` [PATCH v4 3/4] fs/9p: fix type mismatch in file cache mode helper Eric Van Hensbergen
@ 2023-07-19 16:22 ` Eric Van Hensbergen
3 siblings, 0 replies; 5+ messages in thread
From: Eric Van Hensbergen @ 2023-07-19 16:22 UTC (permalink / raw)
To: Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck
Cc: v9fs, linux-kernel, kernel, stable, Robert Schwebel, Eric Van Hensbergen
There was an invalidate_inode_pages2 added to readonly mmap path
that is unnecessary since that path is only entered when writeback
cache is disabled on mount.
Cc: stable@vger.kernel.org
Fixes: 1543b4c5071c ("fs/9p: remove writeback fid and fix per-file modes")
Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com>
Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org>
---
fs/9p/vfs_file.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 9b61b480a9b0..11cd8d23f6f2 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -506,7 +506,6 @@ v9fs_file_mmap(struct file *filp, struct vm_area_struct *vma)
if (!(v9ses->cache & CACHE_WRITEBACK)) {
p9_debug(P9_DEBUG_CACHE, "(read-only mmap mode)");
- invalidate_inode_pages2(filp->f_mapping);
return generic_file_readonly_mmap(filp, vma);
}
--
2.39.2
^ permalink raw reply [flat|nested] 5+ messages in thread