Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp6020493imb; Fri, 8 Mar 2019 07:36:20 -0800 (PST) X-Google-Smtp-Source: APXvYqyzZHQp1mJfxmY+zLi5wNxP7xAgpWWM4XH9qODmHvWgcsdPhJd97O/XBQHWt3RG/DtY7dTp X-Received: by 2002:a63:69c2:: with SMTP id e185mr17219812pgc.4.1552059380411; Fri, 08 Mar 2019 07:36:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552059380; cv=none; d=google.com; s=arc-20160816; b=zyjIbDe9Z/UDBAIfeeEvmo7mRuKs0+pNpr+W68KU/w2SPYHLTC+clnUis71hSXFTbm s0RowldMUhp1ZB+/k74XbO6y4im5Wv6SDim4F5mLzqGEl8kX37V8YBwyORlHm0HgY63Z +h8NhUwh6xTdQCdhc6BkkClHlE7AAINo+jYXzbRCdIKxrvXYGfN522BsAub/LrrT4LT7 iY3SxOXK7f9IlxouvGVB9up849wD+66iNZLH9SADwLQwvo2jWFHFqsQ0Y4ka+sCc1YaO H79HyOkLaisG0PefqHKNuHZqfO/ICR5RbXIDxeamAZjSApqXoLzl+SVoKbYzIxBNDaFD KIZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from; bh=vml7JREmTfgksTpTqo081P+X40VmexXho8TeOvm2mPs=; b=lfnV/tzagiAQhA1hzxLBM5487WADRD6NePDXKyK0pXmTq/ODiG8Ov+P4dcyUyQrymW oGlrMtyQTpxKrJbHSFBqbbHM9FGmWG0lPpz8YsMNRGsFdKplWrdC2In9Rp0jFXzJSyjw KZEojdsitV3YD0Z2LGXu2cdzNfl4p60lAcEX+4NEsgD6SrYdXLjOI5dG0fHLwfyIkef9 m6HVTh87ihPf/WRi288CbffRuJUsKVZSd3g79WQtCSXZLscQjnP3MmAzfyeoZ79fvzcv VFpH4cGXs8XGCwrH+SxY/ogGAZUX0VA1T/aii5VLg/OUJ1gdkW7BECKqV6RTezlz/gPE ik5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2si6895037plr.167.2019.03.08.07.36.04; Fri, 08 Mar 2019 07:36:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726549AbfCHPfJ (ORCPT + 99 others); Fri, 8 Mar 2019 10:35:09 -0500 Received: from mx1.hrz.uni-dortmund.de ([129.217.128.51]:49908 "EHLO unimail.uni-dortmund.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726270AbfCHPfI (ORCPT ); Fri, 8 Mar 2019 10:35:08 -0500 Received: from ios.cs.uni-dortmund.de (ios.cs.uni-dortmund.de [129.217.43.100]) (authenticated bits=0) by unimail.uni-dortmund.de (8.16.0.29/8.16.0.41) with ESMTPSA id x28F4lga021937 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 8 Mar 2019 16:05:03 +0100 (CET) From: Alexander Lochmann Cc: Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Alexander Lochmann , Horst Schirmeier Subject: [PATCH 1/1] Updated locking documentation for struct inode Date: Fri, 8 Mar 2019 16:04:47 +0100 Message-Id: <20190308150447.96311-1-alexander.lochmann@tu-dortmund.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We used LockDoc to derive locking rules for each member of struct inode. Based on those results, we extended the existing documentation by more members of struct inode, and updated the existing documentation. Signed-off-by: Alexander Lochmann Signed-off-by: Horst Schirmeier --- fs/inode.c | 49 ++++++++++++++++++++++++++++++++++++---------- include/linux/fs.h | 2 +- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index 0cd47fe0dbe5..ade9d3aa1ada 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -24,17 +24,46 @@ /* * Inode locking rules: + * (Documentation improved by LockDoc) * - * inode->i_lock protects: - * inode->i_state, inode->i_hash, __iget() - * Inode LRU list locks protect: - * inode->i_sb->s_inode_lru, inode->i_lru - * inode->i_sb->s_inode_list_lock protects: - * inode->i_sb->s_inodes, inode->i_sb_list - * bdi->wb.list_lock protects: - * bdi->wb.b_{dirty,io,more_io,dirty_time}, inode->i_io_list - * inode_hash_lock protects: - * inode_hashtable, inode->i_hash + * No locks needed for: + * i_data.a_ops, i_data.nrexceptional, i_rdev, i_data.gfp_mask, + * i_generation, i_security, i_nlink, __i_nlink, i_flctx, + * i_size, i_atime, i_mtime, i_data.host, i_sb + * + * backing_dev_info.wb.list_lock protects: + * dirtied_when, i_io_list + * + * inode.i_rwsem protects: + * i_flags, i_uid, i_gid, i_version, i_ctime, i_size_seqcount + * + * inode.i_rwsem -> rcu protects: + * i_default_acl + * + * block_device.bd_mutex protects: + * i_blkbits + * + * cdev_lock protects: + * i_cdev, i_devices + * + * inode.i_data.i_mmap_rwsem protects: + * i_data.i_mmap, i_data.i_mmap + * + * hardirq -> inode.i_data.tree_lock protects: + * i_data.page_tree, i_wb_list, i_data.nrpages + * + * hardirq -> super_block.s_inode_wblist_lock protects: + * i_wb_list + * + * inode.i_lock protects: + * i_pipe, i_fsnotify_mask, i_fsnotify_marks, i_blocks, i_opflags, + * i_state, i_bytes + * + * super_block.s_inode_list_lock protects: + * i_sb_list + * + * inode_hash_lock -> inode.i_lock protects: + * i_hash * * Lock ordering: * diff --git a/include/linux/fs.h b/include/linux/fs.h index 92966678539d..744e2a817ad3 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -639,7 +639,7 @@ struct inode { struct timespec64 i_atime; struct timespec64 i_mtime; struct timespec64 i_ctime; - spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ + spinlock_t i_lock; unsigned short i_bytes; u8 i_blkbits; u8 i_write_hint; -- 2.20.1