Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'nowait-aio-btrfs-fixup' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux

Pull btrfs fix from David Sterba:
"This fixes a user-visible bug introduced by the nowait-aio patches
merged in this cycle"

* 'nowait-aio-btrfs-fixup' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
btrfs: nowait aio: Correct assignment of pos

+14 -12
+14 -12
fs/btrfs/file.c
··· 1881 1881 ssize_t num_written = 0; 1882 1882 bool sync = (file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host); 1883 1883 ssize_t err; 1884 - loff_t pos = iocb->ki_pos; 1884 + loff_t pos; 1885 1885 size_t count = iov_iter_count(from); 1886 1886 loff_t oldsize; 1887 1887 int clean_page = 0; 1888 1888 1889 - if ((iocb->ki_flags & IOCB_NOWAIT) && 1890 - (iocb->ki_flags & IOCB_DIRECT)) { 1891 - /* Don't sleep on inode rwsem */ 1892 - if (!inode_trylock(inode)) 1889 + if (!inode_trylock(inode)) { 1890 + if (iocb->ki_flags & IOCB_NOWAIT) 1893 1891 return -EAGAIN; 1892 + inode_lock(inode); 1893 + } 1894 + 1895 + err = generic_write_checks(iocb, from); 1896 + if (err <= 0) { 1897 + inode_unlock(inode); 1898 + return err; 1899 + } 1900 + 1901 + pos = iocb->ki_pos; 1902 + if (iocb->ki_flags & IOCB_NOWAIT) { 1894 1903 /* 1895 1904 * We will allocate space in case nodatacow is not set, 1896 1905 * so bail ··· 1910 1901 inode_unlock(inode); 1911 1902 return -EAGAIN; 1912 1903 } 1913 - } else 1914 - inode_lock(inode); 1915 - 1916 - err = generic_write_checks(iocb, from); 1917 - if (err <= 0) { 1918 - inode_unlock(inode); 1919 - return err; 1920 1904 } 1921 1905 1922 1906 current->backing_dev_info = inode_to_bdi(inode);