On Apr 6, 2015, at 4:09 PM, Al Viro wrote: > On Mon, Apr 06, 2015 at 08:04:01PM +0000, Drokin, Oleg wrote: >> Hello! >> >> On Apr 6, 2015, at 12:02 PM, Al Viro wrote: >>> 2) should we ever update the current position when write() returns 0? >>> IOW, what effect should zero-length write() on O_APPEND file have upon its >>> current position? POSIX seems to imply that it should do nothing, and >>> generally that's what happens, but e.g. ext4 *does* update position to >>> the EOF, whether we will write anything or not. So does FUSE when server >>> requests to bypass the page cache. AFAICS, lustre is the same way, >>> but I might be missing something; everything else definitely does not >> >> Lustre is not the same way. >> drivers/staging/lustre/lustre/llite/file.c::ll_file_io_generic() has this >> if (io-> ci_nob > 0) { >> result = io->ci_nob; >> *ppos = io->u.ci_wr.wr.crw_pos; >> } >> >> and ppos is passed in as &iocb->ki_pos. ci_nob is number of bytes that we managed to read/write, >> and if it was 0 (either due to 0 bytes io request or due to error from the get go) >> we won't update it. > > Eh? vvp_io_write_start(): > result = generic_file_write_iter(cio->cui_iocb, cio->cui_iter); Oh, hm, I guess you mean if (cl_io_is_append(io)) { pos = io->u.ci_wr.wr.crw_pos = i_size_read(inode); cio->cui_iocb->ki_pos = pos; missed that one. It's a leftover from the times we used to call __generic_file_aio_write there and that took &iocb->ki_pos argument. Now that we pass entire iocb in, probably can just drop that ki_pos assignment, I am going to try that now. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html