]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blame - fs/aufs/hfsplus.c
UBUNTU: SAUCE: Update aufs to 5.4.3 20200302
[mirror_ubuntu-focal-kernel.git] / fs / aufs / hfsplus.c
CommitLineData
a3a49a17
SF
1// SPDX-License-Identifier: GPL-2.0
2/*
e4a3f096 3 * Copyright (C) 2010-2020 Junjiro R. Okajima
a3a49a17
SF
4 *
5 * This program, aufs is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/*
20 * special support for filesystems which acquires an inode mutex
21 * at final closing a file, eg, hfsplus.
22 *
23 * This trick is very simple and stupid, just to open the file before really
24 * necessary open to tell hfsplus that this is not the final closing.
25 * The caller should call au_h_open_pre() after acquiring the inode mutex,
26 * and au_h_open_post() after releasing it.
27 */
28
29#include "aufs.h"
30
31struct file *au_h_open_pre(struct dentry *dentry, aufs_bindex_t bindex,
32 int force_wr)
33{
34 struct file *h_file;
35 struct dentry *h_dentry;
36
37 h_dentry = au_h_dptr(dentry, bindex);
38 AuDebugOn(!h_dentry);
39 AuDebugOn(d_is_negative(h_dentry));
40
41 h_file = NULL;
42 if (au_test_hfsplus(h_dentry->d_sb)
43 && d_is_reg(h_dentry))
44 h_file = au_h_open(dentry, bindex,
45 O_RDONLY | O_NOATIME | O_LARGEFILE,
46 /*file*/NULL, force_wr);
47 return h_file;
48}
49
50void au_h_open_post(struct dentry *dentry, aufs_bindex_t bindex,
51 struct file *h_file)
52{
53 struct au_branch *br;
54
55 if (h_file) {
56 fput(h_file);
57 br = au_sbr(dentry->d_sb, bindex);
58 au_lcnt_dec(&br->br_nfiles);
59 }
60}