2
* Copyright (C) 2008 Junjiro Okajima
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.
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.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
* special handling for inode attributes on FUSE branch
22
* $Id: br_fuse.c,v 1.2 2008/04/21 01:32:05 sfjro Exp $
27
/* h_mnt can be NULL, is it safe? */
28
int au_update_fuse_h_inode(struct vfsmount *h_mnt, struct dentry *h_dentry)
33
LKTRTrace("%.*s\n", AuDLNPair(h_dentry));
36
if (unlikely(h_dentry->d_inode
37
//&& atomic_read(&h_dentry->d_inode->i_count)
38
&& au_test_fuse(h_dentry->d_sb))) {
39
err = vfsub_getattr(h_mnt, h_dentry, &st, /*dlgt*/0);
41
AuDbg("err %d\n", err);
43
AuDbgDentry(h_dentry);
51
/* currently, for fuse only */
52
int aufs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *st)
55
struct inode *inode, *h_inode;
56
struct dentry *h_dentry;
58
LKTRTrace("%.*s\n", AuDLNPair(dentry));
61
aufs_read_lock(dentry, AuLock_IR);
62
inode = dentry->d_inode;
63
h_inode = au_h_iptr(inode, au_ibstart(inode));
64
if (unlikely(au_test_fuse(h_inode->i_sb))) {
65
h_dentry = d_find_alias(h_inode);
66
/* simply gave up updating fuse inode */
69
if (!au_update_fuse_h_inode(NULL, h_dentry))
70
au_cpup_attr_all(inode);
74
generic_fillattr(inode, st);
76
aufs_read_unlock(dentry, AuLock_IR);
82
* This function was born after a discussion with the FUSE developer.
83
* The inode attributes on a filesystem who defines i_op->getattr()
84
* is unreliable since such fs may not maintain the attributes at lookup.
85
* This function doesn't want the result of stat, instead wants the side-effect
86
* which refreshes the attributes.
87
* Hmm, there seems to be no such filesystem except fuse.
89
int vfsub_i_attr(struct vfsmount *mnt, struct dentry *dentry, int dlgt)
93
struct inode_operations *op;
96
inode = dentry->d_inode;
101
if (unlikely(op && op->getattr && !au_test_aufs(dentry->d_sb))) {
102
err = security_inode_getattr(mnt, dentry);
104
err = op->getattr(mnt, dentry, &st);