Whamcloud - gitweb
LU-3044 llite: LSeek SEEK_CUR incorrect after O_APPEND write
authorPatrick Farrell <paf@cray.com>
Fri, 29 Mar 2013 17:41:34 +0000 (12:41 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 23 Apr 2013 05:18:55 +0000 (01:18 -0400)
commit48fcf440fe5f9728e3dcdf411bd7969b01e4449d
tree93387f5f031d065ec535c65594f5724adceeb364
parent7d7bb7a4fc0cd6f22ad08261ea138d7d93e433c2
LU-3044 llite: LSeek SEEK_CUR incorrect after O_APPEND write

When a file is opened with O_APPEND set and a write is done,
the file offset value immediately after the write is incorrect.
It is too much by approximately the length of the write.

This can be seen by doing lseek SEEK_CUR immediately after the
write. This does not cause corruption on subsequent writes
because with O_APPEND VFS resets the file offset to EOF before
each write.

This is resolved by removing the change made for BUG:17711,
which was to set crw_pos in ll_prepare_write.

That change was to pass the LASSERT(cl_page_in_io(page, io)) in
cl_io_prepare_write().  However, this assert has since been
modified to exclude the O_APPEND case, making this unnecessary.

crw_pos is also updated in cl_io_rw_advance which is why pos is
greater than expected.

Removing the extra update to crw_pos in ll_prepare_write fixes
this.

Signed-off-by: Patrick Farrell <paf@cray.com>
Change-Id: I7c1ad10eefec44aae415b8cfce6b01bc9b39fc8f
Reviewed-on: http://review.whamcloud.com/5861
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/llite/rw.c