From patchwork Sun Jan 8 10:36:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddh Raman Pant X-Patchwork-Id: 13092466 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 AA19DC53210 for ; Sun, 8 Jan 2023 10:38:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232671AbjAHKhj (ORCPT ); Sun, 8 Jan 2023 05:37:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231454AbjAHKhe (ORCPT ); Sun, 8 Jan 2023 05:37:34 -0500 Received: from sender-of-o50.zoho.in (sender-of-o50.zoho.in [103.117.158.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93CDFE0B9; Sun, 8 Jan 2023 02:37:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673174207; cv=none; d=zohomail.in; s=zohoarc; b=R4sR6HypQhsq0FANUSSfT92ZwhHFDchRxsFIGEqe4+EA8pC9qA2wUtwkh8Kw1iMhCdTIsRsP/mK9je1Z9PNCidJP04cxYDGkoNQ3v5z4rAJSirhFGN1EmBrpik2seKCiS0NvPigLMLU4NpUqmwe3/2ZxL5CnZxwFdGvSvmkOOJg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.in; s=zohoarc; t=1673174207; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=pcXt8bFzKFZCxe/K2x0CZ6wr09PH7+KBAfFhihnTjHU=; b=V7u4OWXFpp4PlPYvEEKPtTBJGA2E3Ov6tJxkWSOT4sq1LQS+aIy9WwTx0h2d5BIrfN1TtaC58A6CnZB/HopVk0+LF/dUY1KLoEZoTaHNpLRFh57Q8NForv76xHyze0DR/CWDcQnCx6VBkkCxdCPpzr7ckl8lf1u/rVQd6kOVTI4= ARC-Authentication-Results: i=1; mx.zohomail.in; dkim=pass header.i=siddh.me; spf=pass smtp.mailfrom=code@siddh.me; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1673174207; s=zmail; d=siddh.me; i=code@siddh.me; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=pcXt8bFzKFZCxe/K2x0CZ6wr09PH7+KBAfFhihnTjHU=; b=MyiAs1b9XVjh7OyDI6QRNFE/1Zxtc78eCokPbQL8L+SA9D0hwRszQaPPS2+vg+Au yEHFVV70X1V0pihDEzq9txLwGCHl8IAx0Esw2lVcvkZ7ygLF8/EQxuq4j615gedgax/ ew1b4vxtQrp2jksCg/e5cnOZJss4nxEvg3aEQd9o= Received: from kampyooter.. (110.226.31.37 [110.226.31.37]) by mx.zoho.in with SMTPS id 1673174205063602.2424519389933; Sun, 8 Jan 2023 16:06:45 +0530 (IST) From: Siddh Raman Pant To: Mauro Carvalho Chehab , Randy Dunlap , David Howells , Jonathan Corbet , "Fabio M. De Francesco" , Eric Dumazet , Christophe JAILLET , Eric Biggers Cc: keyrings , linux-security-module , linux-fsdevel , linux-kernel Message-ID: Subject: [PATCH v3 0/2] watch_queue: Clean up some code Date: Sun, 8 Jan 2023 16:06:30 +0530 X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-ZohoMailClient: External Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org There is a dangling reference to pipe in a watch_queue after clearing it. Thus, NULL that pointer while clearing. This change renders wqueue->defunct superfluous, as the latter is only used to check if watch_queue is cleared. With this change, the pipe is NULLed while clearing, so we can just check if the pipe is NULL. Extending comment for watch_queue->pipe in the definition of watch_queue made the comment conventionally too long (it was already past 80 chars), so I have changed the struct annotations to be kerneldoc-styled, so that I can extend the comment mentioning that the pipe is NULL when watch_queue is cleared. In the process, I have also hopefully improved documentation by documenting things which weren't documented before. Changes in v3: - Fixed misplaced/incorrect comment for members watch_list and list_node in struct watch. - Minor rephrase of comment before NULLing in watch_queue_clear(). Changes in v2 (6 Aug 2022): - Merged the NULLing and removing defunct patches. - Removed READ_ONCE barrier in lock_wqueue(). - Improved and fixed errors in struct docs. - Better commit messages. Siddh Raman Pant (2): include/linux/watch_queue: Improve documentation kernel/watch_queue: NULL the dangling *pipe, and use it for clear check include/linux/watch_queue.h | 100 ++++++++++++++++++++++++++---------- kernel/watch_queue.c | 12 ++--- 2 files changed, 79 insertions(+), 33 deletions(-)