From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kara Subject: i_flags locking Date: Mon, 25 Jun 2007 18:42:44 +0200 Message-ID: <20070625164244.GK18198@duck.suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: linux-fsdevel@vger.kernel.org Return-path: Received: from styx.suse.cz ([82.119.242.94]:35595 "EHLO duck.suse.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752383AbXFYQ2u (ORCPT ); Mon, 25 Jun 2007 12:28:50 -0400 Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Hi, I came across the following question: What is the proper locking for using i_flags? I've noticed i_flags are read freely without any lock. The modifications I've seen e.g. in ext3 were done under i_mutex. Is this right? BTW it means that when checking i_flags we can see intermediate states in ext3_set_inode_flags() when all flags are cleared and the proper flags are not yet set, right? I'm currently playing with something like inotify for subtree and I'd need to modify i_flags but using i_mutex unpleasantly interferes with directory locking... Honza -- Jan Kara SuSE CR Labs