Skip to content

Commit 7909b1c

Browse files
author
Miklos Szeredi
committed
fuse: don't use atomic kmap
Don't use atomic kmap for mapping userspace buffers in device read/write/splice. This is necessary because the next patch (adding store notify) requires that caller of fuse_copy_page() may sleep between invocations. The simplest way to ensure this is to change the atomic kmaps to non-atomic ones. Thankfully architectures where kmap() is not a no-op are going out of fashion, so we can ignore the (probably negligible) performance impact of this change. Signed-off-by: Miklos Szeredi <[email protected]>
1 parent 815c416 commit 7909b1c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

fs/fuse/dev.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -535,13 +535,13 @@ static void fuse_copy_finish(struct fuse_copy_state *cs)
535535
if (!cs->write) {
536536
buf->ops->unmap(cs->pipe, buf, cs->mapaddr);
537537
} else {
538-
kunmap_atomic(cs->mapaddr, KM_USER0);
538+
kunmap(buf->page);
539539
buf->len = PAGE_SIZE - cs->len;
540540
}
541541
cs->currbuf = NULL;
542542
cs->mapaddr = NULL;
543543
} else if (cs->mapaddr) {
544-
kunmap_atomic(cs->mapaddr, KM_USER0);
544+
kunmap(cs->pg);
545545
if (cs->write) {
546546
flush_dcache_page(cs->pg);
547547
set_page_dirty_lock(cs->pg);
@@ -572,7 +572,7 @@ static int fuse_copy_fill(struct fuse_copy_state *cs)
572572

573573
BUG_ON(!cs->nr_segs);
574574
cs->currbuf = buf;
575-
cs->mapaddr = buf->ops->map(cs->pipe, buf, 1);
575+
cs->mapaddr = buf->ops->map(cs->pipe, buf, 0);
576576
cs->len = buf->len;
577577
cs->buf = cs->mapaddr + buf->offset;
578578
cs->pipebufs++;
@@ -592,7 +592,7 @@ static int fuse_copy_fill(struct fuse_copy_state *cs)
592592
buf->len = 0;
593593

594594
cs->currbuf = buf;
595-
cs->mapaddr = kmap_atomic(page, KM_USER0);
595+
cs->mapaddr = kmap(page);
596596
cs->buf = cs->mapaddr;
597597
cs->len = PAGE_SIZE;
598598
cs->pipebufs++;
@@ -611,7 +611,7 @@ static int fuse_copy_fill(struct fuse_copy_state *cs)
611611
return err;
612612
BUG_ON(err != 1);
613613
offset = cs->addr % PAGE_SIZE;
614-
cs->mapaddr = kmap_atomic(cs->pg, KM_USER0);
614+
cs->mapaddr = kmap(cs->pg);
615615
cs->buf = cs->mapaddr + offset;
616616
cs->len = min(PAGE_SIZE - offset, cs->seglen);
617617
cs->seglen -= cs->len;

0 commit comments

Comments
 (0)