Hi David, I noticed 2 other issues while running xfstests. Noticed kernel OOPS during test generic/286: folio_test_writeback returned false which means PG_writeback flag has been cleared. I am not sure whether head page has PG_writeback flag set initially? Can you please confirm. [ 2275.941096] CIFS: bad 2000 @64f0000 page 64f0 64f1 [ 2275.945785] ------------[ cut here ]------------ [ 2275.945787] kernel BUG at /home/lxsmbadmin/latest_14mar/linux-fs/fs/cifs/cifssmb.c:1954! [ 2275.952198] invalid opcode: 0000 [#1] PREEMPT SMP PTI [ 2275.956500] CPU: 0 PID: 3369 Comm: kworker/0:7 Tainted: G OE 5.17.0-rc6+ #1 [ 2275.962573] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v4.1 10/27/2020 [ 2275.969812] Workqueue: cifsiod cifs_writev_complete [cifs] [ 2275.974909] RIP: 0010:cifs_pages_written_back+0x1e1/0x1f0 [cifs] [ 2275.975570] CIFS: bad 2000 @64f0000 page 64f0 64f1 [ 2275.980619] Code: 00 48 8b 07 f6 c4 04 0f 84 92 84 06 00 e8 77 a6 e6 db 48 89 c1 49 89 d8 4c 89 e2 44 89 ee 48 c7 c7 e0 f5 8e c0 e8 a4 9d 71 dc <0f> 0b e8 58 f5 76 dc 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 55 48 [ 2275.980622] RSP: 0018:ffffac614177fdc8 EFLAGS: 00010246 [ 2275.980625] RAX: 0000000000000026 RBX: 00000000000064f1 RCX: 0000000000000000 [ 2275.980626] RDX: 0000000000000000 RSI: ffffffff9d767af1 RDI: 00000000ffffffff [ 2275.980628] RBP: ffffac614177fe28 R08: 0000000000000000 R09: ffffac614177fbc0 [ 2275.980629] R10: ffffac614177fbb8 R11: ffffffff9df52b68 R12: 00000000064f0000 [ 2275.980631] R13: 0000000000002000 R14: 0000000000000000 R15: ffff9c8193bc7e40 [ 2275.980632] FS: 0000000000000000(0000) GS:ffff9c8337c00000(0000) knlGS:0000000000000000 [ 2275.980636] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2275.980638] CR2: 00007fd099e56b90 CR3: 00000001028e4006 CR4: 00000000003706f0 [ 2275.980639] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2275.980640] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 2275.980641] Call Trace: [ 2275.980643] <TASK> [ 2275.980648] cifs_writev_complete+0x43d/0x500 [cifs] Noticed that with netfs integration, file open with O_DIRECT flag is not supported. Regards, Rohith On Tue, Mar 15, 2022 at 9:20 AM Rohith Surabattula <rohiths.msft@xxxxxxxxx> wrote: > > Hi David, > > Below change needs to be applied on top of your branch. > > lxsmbadmin@netfsvm:~/latest_14mar/linux-fs$ git diff > diff --git a/fs/cifs/file.c b/fs/cifs/file.c > index af7483c246ac..447934ff80b8 100644 > --- a/fs/cifs/file.c > +++ b/fs/cifs/file.c > @@ -2969,6 +2969,12 @@ cifs_write_from_iter(loff_t offset, size_t len, > struct iov_iter *from, > > cur_len = min_t(const size_t, len, wsize); > > + if (!cur_len) { > + rc = -EAGAIN; > + add_credits_and_wake_if(server, credits, 0); > + break; > + } > + > wdata = cifs_writedata_alloc(cifs_uncached_writev_complete); > if (!wdata) { > rc = -ENOMEM; > > lxsmbadmin@netfsvm:~/xfstests-dev$ sudo ./check generic/013 > SECTION -- smb3 > FSTYP -- cifs > PLATFORM -- Linux/x86_64 netfsvm 5.17.0-rc6+ #1 SMP PREEMPT Mon > Mar 14 09:05:47 UTC 2022 > MKFS_OPTIONS -- //127.0.0.1/sambashare_scratch > MOUNT_OPTIONS -- -ousername=,password=,noperm,vers=3.0,actimeo=0 > //127.0.0.1/sambashare_scratch /mnt/xfstests_scratch > > generic/013 149s > Ran: generic/013 > Passed all 1 tests > > SECTION -- smb3 > ========================= > Ran: generic/013 > Passed all 1 tests > > Regards, > Rohith > > On Fri, Mar 11, 2022 at 1:56 PM David Howells <dhowells@xxxxxxxxxx> wrote: > > > > > > David Howells <dhowells@xxxxxxxxxx> wrote: > > > > > The other issue is that if I run splice to an empty file, it works; running > > > another splice to the same file will result in the server giving > > > STATUS_ACCESS_DENIED when cifs_write_begin() tries to read from the file: > > > > > > 7 0.009485249 192.168.6.2 → 192.168.6.1 SMB2 183 Read Request Len:65536 Off:0 File: x > > > 8 0.009674245 192.168.6.1 → 192.168.6.2 SMB2 143 Read Response, Error: STATUS_ACCESS_DENIED > > > > > > Actually - that might be because the file is only 65536 bytes long because the > > > first splice finished short. > > > > Actually, it's because I opened the output file O_WRONLY. If I open it > > O_RDWR, it works. The test program is attached below. > > > > David > > --- > > #define _GNU_SOURCE > > #include <stdio.h> > > #include <stdlib.h> > > #include <string.h> > > #include <unistd.h> > > #include <fcntl.h> > > > > int main(int argc, char *argv[]) > > { > > off64_t opos; > > size_t len; > > int in, out; > > > > if (argc != 4) { > > printf("Format: %s size in out\n", argv[0]); > > exit(2); > > } > > > > len = atol(argv[1]); > > > > if (strcmp(argv[2], "-") != 0) { > > in = open(argv[2], O_RDONLY); > > if (in < 0) { > > perror(argv[2]); > > return 1; > > } > > } else { > > in = 0; > > } > > > > if (strcmp(argv[3], "-") != 0) { > > out = open(argv[3], O_WRONLY); // Change to O_RDWR > > if (out < 0) { > > perror(argv[3]); > > return 1; > > } > > } else { > > out = 1; > > } > > > > opos = 3; > > if (splice(in, NULL, out, &opos, len, 0) < 0) { > > perror("splice"); > > return 1; > > } > > > > if (close(in) < 0) { > > perror("close/in"); > > return 1; > > } > > > > if (close(out) < 0) { > > perror("close/out"); > > return 1; > > } > > > > return 0; > > } > >