提交 efe69414 编写于 作者: C Cyril Bur 提交者: Michael Ellerman

mtd: powernv_flash: Don't return -ERESTARTSYS on interrupted token acquisition

Because the MTD core might split up a read() or write() from userspace
into several calls to the driver, we may fail to get a token but already
have done some work, best to return -EINTR back to userspace and have
them decide what to do.
Signed-off-by: NCyril Bur <cyrilbur@gmail.com>
Acked-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 e32ec15a
...@@ -47,6 +47,11 @@ enum flash_op { ...@@ -47,6 +47,11 @@ enum flash_op {
FLASH_OP_ERASE, FLASH_OP_ERASE,
}; };
/*
* Don't return -ERESTARTSYS if we can't get a token, the MTD core
* might have split up the call from userspace and called into the
* driver more than once, we'll already have done some amount of work.
*/
static int powernv_flash_async_op(struct mtd_info *mtd, enum flash_op op, static int powernv_flash_async_op(struct mtd_info *mtd, enum flash_op op,
loff_t offset, size_t len, size_t *retlen, u_char *buf) loff_t offset, size_t len, size_t *retlen, u_char *buf)
{ {
...@@ -63,6 +68,8 @@ static int powernv_flash_async_op(struct mtd_info *mtd, enum flash_op op, ...@@ -63,6 +68,8 @@ static int powernv_flash_async_op(struct mtd_info *mtd, enum flash_op op,
if (token < 0) { if (token < 0) {
if (token != -ERESTARTSYS) if (token != -ERESTARTSYS)
dev_err(dev, "Failed to get an async token\n"); dev_err(dev, "Failed to get an async token\n");
else
token = -EINTR;
return token; return token;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册