* [PATCH] ubifs: fix read fail but return ok
@ 2021-03-31 6:27 wangfangpeng
2021-04-07 22:11 ` Richard Weinberger
0 siblings, 1 reply; 2+ messages in thread
From: wangfangpeng @ 2021-03-31 6:27 UTC (permalink / raw)
To: richard, ext-adrian.hunter, Artem.Bityutskiy, linux-mtd, linux-kernel
Cc: nixiaoming, zengweilin, stable
do_readpage() may return err, but ubifs_readpage() always return ok.
The vfs will ignore the err happen in ubifs.
Fixes: 1e51764a3c2ac05a2 ("UBIFS: add new flash file system")
Cc: <stable@vger.kernel.org> #v2.6.27
Signed-off-by: wangfangpeng <wangfangpeng1@huawei.com>
---
fs/ubifs/file.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 0e4b4be3aa26..001feec1d415 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -892,11 +892,13 @@ static int ubifs_bulk_read(struct page *page)
static int ubifs_readpage(struct file *file, struct page *page)
{
+ int ret;
+
if (ubifs_bulk_read(page))
return 0;
- do_readpage(page);
+ ret = do_readpage(page);
unlock_page(page);
- return 0;
+ return ret;
}
static int do_writepage(struct page *page, int len)
--
2.12.3
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ubifs: fix read fail but return ok
2021-03-31 6:27 [PATCH] ubifs: fix read fail but return ok wangfangpeng
@ 2021-04-07 22:11 ` Richard Weinberger
0 siblings, 0 replies; 2+ messages in thread
From: Richard Weinberger @ 2021-04-07 22:11 UTC (permalink / raw)
To: wangfangpeng
Cc: Richard Weinberger, Adrian Hunter, Artem Bityutskiy, linux-mtd,
LKML, Xiaoming Ni, zengweilin, stable
On Wed, Mar 31, 2021 at 8:29 AM wangfangpeng <wangfangpeng1@huawei.com> wrote:
> do_readpage() may return err, but ubifs_readpage() always return ok.
> The vfs will ignore the err happen in ubifs.
Are you sure about that?
In case of an error UBIFS sets the error flag of the page and does not
mark it as uptodate,
so vfs will emit -EIO. At least this is the theory. :-)
--
Thanks,
//richard
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-07 22:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31 6:27 [PATCH] ubifs: fix read fail but return ok wangfangpeng
2021-04-07 22:11 ` Richard Weinberger
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).