• Nicholas Bellinger's avatar
    target/file: Use O_DSYNC by default for FILEIO backends · 45a0374f
    Nicholas Bellinger authored
    commit a4dff304 upstream.
    
    Convert to use O_DSYNC for all cases at FILEIO backend creation time to
    avoid the extra syncing of pure timestamp updates with legacy O_SYNC during
    default operation as recommended by hch.  Continue to do this independently of
    Write Cache Enable (WCE) bit, as WCE=0 is currently the default for all backend
    devices and enabled by user on per device basis via attrib/emulate_write_cache.
    
    This patch drops the now unnecessary fd_buffered_io= token usage that was
    originally signalling when to explictly disable O_SYNC at backend creation
    time for buffered I/O operation.  This can end up being dangerous for a number
    of reasons during physical node failure, so go ahead and drop this option
    for now when O_DSYNC is used as the default.
    
    Also allow explict FUA WRITEs -> vfs_fsync_range() call to function in
    fd_execute_cmd() independently of WCE bit setting.
    Reported-by: default avatarChristoph Hellwig <hch@lst.de>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    [bwh: Backported to 3.2:
     - We have fd_do_task() and not fd_execute_cmd()
     - Various fields are in struct se_task rather than struct se_cmd
     - fd_create_virtdevice() flags initialisation hasn't been cleaned up]
    Cc: Li Zefan <lizefan@huawei.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    45a0374f
target_core_file.h 952 Bytes