Bug 110391 - sendfile(2) not killable on btrfs
Summary: sendfile(2) not killable on btrfs
Status: NEW
Alias: None
Product: File System
Classification: Unclassified
Component: btrfs (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Josef Bacik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-06 09:05 UTC by Akihiro Suda
Modified: 2016-03-20 09:59 UTC (History)
2 users (show)

See Also:
Kernel Version: 4.2.0-22-generic (Ubuntu 15.10)
Tree: Mainline
Regression: No


Attachments

Description Akihiro Suda 2016-01-06 09:05:58 UTC
Commit 296291cd should have made sendfile(2) killable.

https://github.com/torvalds/linux/commit/296291cd
> mm: make sendfile(2) killable
>
> Currently a simple program below issues a sendfile(2) system call which
> takes about 62 days to complete in my test KVM instance.
> 
>         int fd;
>         off_t off = 0;
> 
>         fd = open("file", O_RDWR | O_TRUNC | O_SYNC | O_CREAT, 0644);
>         ftruncate(fd, 2);
>         lseek(fd, 0, SEEK_END);
>         sendfile(fd, fd, &off, 0xfffffff);
> 
> Now you should not ask kernel to do a stupid stuff like copying 256MB in
> 2-byte chunks and call fsync(2) after each chunk but if you do, sysadmin
> should have a way to stop you.


However, it is still not killable on btrfs.

Stack trace:

  [<ffffffffc021ea60>] write_all_supers.isra.45+0x960/0xb00 [btrfs]
  [<ffffffffc02200f7>] write_ctree_super+0x17/0x20 [btrfs]
  [<ffffffffc026b1c7>] btrfs_sync_log+0x897/0xb40 [btrfs]
  [<ffffffffc023d0c8>] btrfs_sync_file+0x328/0x360 [btrfs]
  [<ffffffff8122fe9b>] vfs_fsync_range+0x4b/0xb0
  [<ffffffffc023d307>] btrfs_file_write_iter+0x207/0x510 [btrfs]
  [<ffffffff811fca0b>] new_sync_write+0x9b/0xe0
  [<ffffffff811fca76>] __vfs_write+0x26/0x40
  [<ffffffff811fce13>] __kernel_write+0x53/0xf0
  [<ffffffff8122d832>] write_pipe_buf+0x72/0xa0
  [<ffffffff8122d349>] __splice_from_pipe+0xf9/0x170
  [<ffffffff8122eeee>] splice_from_pipe+0x5e/0x90
  [<ffffffff8122ef5d>] default_file_splice_write+0x1d/0x30
  [<ffffffff8122cda6>] direct_splice_actor+0x36/0x40
  [<ffffffff8122d9d6>] splice_direct_to_actor+0xe6/0x210
  [<ffffffff8122db98>] do_splice_direct+0x98/0xd0
  [<ffffffff811fddef>] do_sendfile+0x1bf/0x3a0
  [<ffffffff811fea2e>] SyS_sendfile64+0x5e/0xb0
  [<ffffffff817f02b2>] entry_SYSCALL_64_fastpath+0x16/0x75
  [<ffffffffffffffff>] 0xffffffffffffffff

Note You need to log in before you can comment on or make changes to this bug.