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