Hi Kindly ping. ^_^ Best Regards, Xiao Yang -----Original Message----- From: Yang, Xiao/杨 晓 <yangx.jy@xxxxxxxxxxx> Sent: 2022年11月17日 10:28 To: Stefan Roesch <shr@xxxxxxxx>; shr@xxxxxx; djwong@xxxxxxxxxx Cc: linux-xfs@xxxxxxxxxxxxxxx; Ruan, Shiyang/阮 世阳 <ruansy.fnst@xxxxxxxxxxx> Subject: Re: [PATCH] xfs: Call kiocb_modified() for buffered write On 2022/11/17 3:00, Stefan Roesch write: > > On 11/16/22 6:42 AM, Xiao Yang wrote: >> kiocb_modified() should be used for sync/async buffered write because >> it will return -EAGAIN when IOCB_NOWAIT is set. Unfortunately, >> kiocb_modified() is used by the common xfs_file_write_checks() which >> is called by all types of write(i.e. buffered/direct/dax write). >> This issue makes generic/471 with xfs always get the following error: >> -------------------------------------------------------- >> QA output created by 471 >> pwrite: Resource temporarily unavailable wrote 8388608/8388608 bytes >> at offset 0 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX >> ops/sec) >> pwrite: Resource temporarily unavailable ... >> -------------------------------------------------------- >> > There have been earlier discussions about this. Snippet from the > earlier discussion: > > "generic/471 complains because it expects any write done with > RWF_NOWAIT to succeed as long as the blocks for the write are already instantiated. > This isn't necessarily a correct assumption, as there are other > conditions that can cause an RWF_NOWAIT write to fail with -EAGAIN > even if the range is already there." Hi Stefan, Thanks for your reply. Could you give me the URL about the earlier discussions? kiocb_modified() makes all types of write always get -EAGAIN when RWF_NOWAIT is set. I don't think this patch[1] is correct because it changed the original logic. The original logic only makes buffered write get -EOPNOTSUPP when RWF_NOWAIT is set. --------------------------------------------- static int file_modified_flags(struct file *file, int flags) { ... if (flags & IOCB_NOWAIT) return -EAGAIN; ... } int kiocb_modified(struct kiocb *iocb) { return file_modified_flags(iocb->ki_filp, iocb->ki_flags); } --------------------------------------------- PS: kiocb_modified() is used by the common xfs_file_write_checks() which is called by all types of write(i.e. buffered/direct/dax write). > > So the test itself probably needs fixing. In my opinion, both kernel and the test probably need to be fixed. [1] 1aa91d9c9933 ("xfs: Add async buffered write support") Best Regards, Xiao Yang