* [bug report] CIFS: Fix splice read for non-cached files
@ 2022-07-12 11:03 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2022-07-12 11:03 UTC (permalink / raw)
To: pshilov; +Cc: linux-cifs
Hello Pavel Shilovsky,
The patch 9c25702cee14: "CIFS: Fix splice read for non-cached files"
from Jan 19, 2017, leads to the following Smatch static checker
warning:
lib/iov_iter.c:293 append_pipe()
warn: sleeping in atomic context
fs/cifs/file.c
3524 static int
3525 cifs_readdata_to_iov(struct cifs_readdata *rdata, struct iov_iter *iter)
3526 {
3527 size_t remaining = rdata->got_bytes;
3528 unsigned int i;
3529
3530 for (i = 0; i < rdata->nr_pages; i++) {
3531 struct page *page = rdata->pages[i];
3532 size_t copy = min_t(size_t, remaining, PAGE_SIZE);
3533 size_t written;
3534
3535 if (unlikely(iov_iter_is_pipe(iter))) {
3536 void *addr = kmap_atomic(page);
Should this be atomic?
3537
3538 written = copy_to_iter(addr, copy, iter);
Smatch complains that copy_to_iter() can sleep so it leads to a sleeping
in atomic warning. The call tree is:
cifs_readdata_to_iov() <- disables preempt
-> copy_to_iter()
-> _copy_to_iter()
-> copy_pipe_to_iter()
-> append_pipe() the push_anon() function does a sleeping alloc
3539 kunmap_atomic(addr);
3540 } else
3541 written = copy_page_to_iter(page, 0, copy, iter);
3542 remaining -= written;
3543 if (written < copy && iov_iter_count(iter) > 0)
3544 break;
3545 }
3546 return remaining ? -EFAULT : 0;
3547 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-12 11:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-12 11:03 [bug report] CIFS: Fix splice read for non-cached files Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox