From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46443C38A04 for ; Tue, 5 Apr 2022 09:08:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236486AbiDEJDB (ORCPT ); Tue, 5 Apr 2022 05:03:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239433AbiDEIpK (ORCPT ); Tue, 5 Apr 2022 04:45:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5334521818; Tue, 5 Apr 2022 01:36:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 94446B81C19; Tue, 5 Apr 2022 08:36:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBD19C385A1; Tue, 5 Apr 2022 08:36:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649147761; bh=K4YK61ZHQ4C2dglVmu0FVz9GSjEUxRnSVAYUZsF2IdE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jMRvaBPepPJnOmXjKD/yy3ViSpMw0rDo0TdpG5TrGOviEyphaiEMiNmf56D/qlK2c rK4zyNCz7m2G4R3tuvTnj4i3uJkjE0LHEB24XngXR/0hpAlkAlqEwpAYYjIvHrsnQ1 9efq9FRWafrnpK5bwar4Z+b/x/w6f64SmhF8jPeE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jens Axboe Subject: [PATCH 5.16 0110/1017] io_uring: ensure that fsnotify is always called Date: Tue, 5 Apr 2022 09:17:03 +0200 Message-Id: <20220405070357.461816904@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jens Axboe commit f63cf5192fe3418ad5ae1a4412eba5694b145f79 upstream. Ensure that we call fsnotify_modify() if we write a file, and that we do fsnotify_access() if we read it. This enables anyone using inotify on the file to get notified. Ditto for fallocate, ensure that fsnotify_modify() is called. Cc: stable@vger.kernel.org Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- fs/io_uring.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2720,8 +2720,12 @@ static bool io_rw_should_reissue(struct static bool __io_complete_rw_common(struct io_kiocb *req, long res) { - if (req->rw.kiocb.ki_flags & IOCB_WRITE) + if (req->rw.kiocb.ki_flags & IOCB_WRITE) { kiocb_end_write(req); + fsnotify_modify(req->file); + } else { + fsnotify_access(req->file); + } if (unlikely(res != req->result)) { if ((res == -EAGAIN || res == -EOPNOTSUPP) && io_rw_should_reissue(req)) { @@ -4211,6 +4215,8 @@ static int io_fallocate(struct io_kiocb req->sync.len); if (ret < 0) req_set_fail(req); + else + fsnotify_modify(req->file); io_req_complete(req, ret); return 0; }