From: Vyacheslav Dubeyko <slava@dubeyko.com>
To: Sergei Antonov <saproj@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>,
Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH v2] hfsplus: add HFSX subfolder count support
Date: Sat, 08 Feb 2014 16:21:20 +0400 [thread overview]
Message-ID: <1391862080.15555.112.camel@ubuntu> (raw)
In-Reply-To: <CABikg9y6P77oEEU94rWFOY9yixKkoCw4b4KzrighDG=6Dzq5pA@mail.gmail.com>
On Sat, 2014-02-08 at 10:17 +0100, Sergei Antonov wrote:
> On 7 February 2014 22:22, Andrew Morton <akpm@linux-foundation.org> wrote:
> > On Fri, 7 Feb 2014 20:35:59 +0100 Sergei Antonov <saproj@gmail.com> wrote:
> >
> >> This patch adds support for HFSX 'HasFolderCount' flag and a corresponding
> >> 'folderCount' field in folder records. (For reference see HFS_FOLDERCOUNT
> >> and kHFSHasFolderCountBit/kHFSHasFolderCountMask in Apple's source code.)
> >>
> [skip]
> >
> > Two of hfsplus_rename_cat()'s callers hold vh_mutex, hfsplus_rename()
> > does not. Which lock is preventing the obvious races here?
>
> Each inode has its own counter and every counter increment and
> decrement is done while inode->i_mutex is locked.
>
The vh_mutex is held by hfsplus_rmdir() and hfsplus_unlink in the
hfsplus_rename() method:
if (new_dentry->d_inode) {
if (S_ISDIR(new_dentry->d_inode->i_mode))
res = hfsplus_rmdir(new_dir, new_dentry);
else
res = hfsplus_unlink(new_dir, new_dentry);
if (res)
return res;
}
These methods can modify shared superblock's fields.
The hfsplus_rename_cat() method operates with inodes and CatalogFile's
metadata only. Before any operations inside CatalogFile we need to find
position of searching record. And it is made hfs_find_init() call before
such operation. This call locks btree's mutex on the whole operation
with the tree. Finally, this mutex is unlocked in hfs_find_exit() call.
But, as Sergei is said yet, added in the patch "subfolders" field is the
count of child folders inside parent one. So, this counter lives inside
inode (folder record of CatalogFile on the volume).
Thanks,
Vyacheslav Dubeyko.
prev parent reply other threads:[~2014-02-08 12:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-07 19:35 [PATCH v2] hfsplus: add HFSX subfolder count support Sergei Antonov
2014-02-07 21:22 ` Andrew Morton
2014-02-08 9:17 ` Sergei Antonov
2014-02-08 12:21 ` Vyacheslav Dubeyko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1391862080.15555.112.camel@ubuntu \
--to=slava@dubeyko.com \
--cc=akpm@linux-foundation.org \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=saproj@gmail.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox