From patchwork Wed Sep 21 09:27:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddh Raman Pant X-Patchwork-Id: 12983494 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 0C2C7C6FA92 for ; Wed, 21 Sep 2022 09:29:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231691AbiIUJ3P (ORCPT ); Wed, 21 Sep 2022 05:29:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231637AbiIUJ3K (ORCPT ); Wed, 21 Sep 2022 05:29:10 -0400 Received: from sender-of-o50.zoho.in (sender-of-o50.zoho.in [103.117.158.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0441B90808; Wed, 21 Sep 2022 02:29:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663752488; cv=none; d=zohomail.in; s=zohoarc; b=DyPkmnbo/DgdALbJ52LApIG2RqgJrBXp54iMKHR2N8joa9qpQH0xRgYMaegejSefqgsnrjqqSx+Ccn1DYBZQIMgs57/eBSvxYvT8bGUksMEXqTTr44+vEoBOw2hBNnFa9ZvmuHeL3UP94yYFRafb5xdMCVyCVdJgSGRiZKT46dc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.in; s=zohoarc; t=1663752488; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=1j9B3a9+XvhyGJpimzS54jknD3atX0UsgCNgtn4m3hM=; b=PLirgJsQpDyE0sg0mrXKK4V5ji2GKVzgNcrtjvL9sXiI0AajxbNhzX/j0Nhpl3ytH2euBv81fYNVwOcKWhQ/deUZONY69m/tvV4elGfQKHiq0nKSMNC56ptUsBdmF3wIdh/bTefRgRHvdLDYXJh4OVbSXiEzC75gG9zZmaY8f7w= 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=1663752488; 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=1j9B3a9+XvhyGJpimzS54jknD3atX0UsgCNgtn4m3hM=; b=lGEFgPrPlgUunVg4iRYjjKsEFUFsp368JW4/G7YMvZJPZGPyESa4w1WqZHQb7RsZ igUC8LSnIeOaNuYs2p8WtTP2IFjv1nXx6QF1xaS97Imgr/oWsHsf0LzJ//HxjuzukAu h8RFhBAxxyKlg4kUwWStl0MZNXHn0QNj4mumG74w= Received: from localhost.localdomain (103.240.204.191 [103.240.204.191]) by mx.zoho.in with SMTPS id 1663752487704363.0191740785489; Wed, 21 Sep 2022 14:58:07 +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 , linux-kernel-mentees Message-ID: Subject: [RESEND PATCH v2 0/2] watch_queue: Clean up some code Date: Wed, 21 Sep 2022 14:57:44 +0530 X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-ZohoMailClient: External Precedence: bulk List-ID: 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 v2: - 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(-)