From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 731051F4727; Wed, 6 Nov 2024 12:39:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730896791; cv=none; b=U8JVfQkDAXixChI4z43p52MnLr1cBxu/pVWdO5MCSCGgLdngL/cbnyeC3WpvFspDshEitnenSgxFm4xgQKg2CwLamD3n14tgc01LCxhuN0ptEgJ1z9SHfNxNsXP0hLhkPWwrKAf6h9Z4Pu8ZcD7SaFnrUKHTeP4bu1duy6sJRKw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730896791; c=relaxed/simple; bh=6hOjKbRFt6pgiMdgRZXD8qEztCWgCGvAenmgq/IQj6k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uO1smtnADWiEn5dYu6ypynhIDD9nu024u2xrbVsXXXPxGLmwVVhiBnbt2lO38zrxUCuZrUwc2w2z3KTlSUfpjQWjgH6WfqvcCW6jB8lANcmQHTgvNTQMG5g6BNVb09mPtAr7iCkodWCOFSbIhZfXbqJSmegR+TGpPsSBVTWfIjg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fjpT6nZt; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="fjpT6nZt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B0E8C4CECD; Wed, 6 Nov 2024 12:39:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1730896791; bh=6hOjKbRFt6pgiMdgRZXD8qEztCWgCGvAenmgq/IQj6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fjpT6nZtGyCfRHkE1RKTPF9rEm+kD6a5CuSfYw/wfhtLv+4GedZ5jzzU6zZ+PYL8W s/jKTL1iJ7rKxWwT/uuj4Mi6A34WXeh2+po9T/i012d/Yc+MMgw7elYrYDwbYAfWqj PiX1yYSpmyIWLEOAIa9FmO25gGD0xbPZCBcM9k5s= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christoph Hellwig , Damien Le Moal , Hannes Reinecke , "Darrick J. Wong" , Al Viro , Andreas Gruenbacher , Anna Schumaker , Chao Yu , Christian Brauner , Ilya Dryomov , Jaegeuk Kim , Jens Axboe , Johannes Thumshirn , Matthew Wilcox , Miklos Szeredi , Miklos Szeredi , Theodore Tso , Trond Myklebust , Xiubo Li , Andrew Morton , Mahmoud Adam , Sasha Levin Subject: [PATCH 5.10 027/110] iomap: update ki_pos a little later in iomap_dio_complete Date: Wed, 6 Nov 2024 13:03:53 +0100 Message-ID: <20241106120303.920654237@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241106120303.135636370@linuxfoundation.org> References: <20241106120303.135636370@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christoph Hellwig upstream 936e114a245b6e38e0dbf706a67e7611fc993da1 commit. Move the ki_pos update down a bit to prepare for a better common helper that invalidates pages based of an iocb. Link: https://lkml.kernel.org/r/20230601145904.1385409-3-hch@lst.de Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Darrick J. Wong Cc: Al Viro Cc: Andreas Gruenbacher Cc: Anna Schumaker Cc: Chao Yu Cc: Christian Brauner Cc: Ilya Dryomov Cc: Jaegeuk Kim Cc: Jens Axboe Cc: Johannes Thumshirn Cc: Matthew Wilcox Cc: Miklos Szeredi Cc: Miklos Szeredi Cc: Theodore Ts'o Cc: Trond Myklebust Cc: Xiubo Li Signed-off-by: Andrew Morton Signed-off-by: Mahmoud Adam Signed-off-by: Sasha Levin --- fs/iomap/direct-io.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index 933f234d5becd..8a49c0d3a7b46 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -93,7 +93,6 @@ ssize_t iomap_dio_complete(struct iomap_dio *dio) if (offset + ret > dio->i_size && !(dio->flags & IOMAP_DIO_WRITE)) ret = dio->i_size - offset; - iocb->ki_pos += ret; } /* @@ -119,15 +118,18 @@ ssize_t iomap_dio_complete(struct iomap_dio *dio) } inode_dio_end(file_inode(iocb->ki_filp)); - /* - * If this is a DSYNC write, make sure we push it to stable storage now - * that we've written data. - */ - if (ret > 0 && (dio->flags & IOMAP_DIO_NEED_SYNC)) - ret = generic_write_sync(iocb, ret); - kfree(dio); + if (ret > 0) { + iocb->ki_pos += ret; + /* + * If this is a DSYNC write, make sure we push it to stable + * storage now that we've written data. + */ + if (dio->flags & IOMAP_DIO_NEED_SYNC) + ret = generic_write_sync(iocb, ret); + } + kfree(dio); return ret; } EXPORT_SYMBOL_GPL(iomap_dio_complete); -- 2.43.0