96
96
struct au_do_lookup_args *args)
98
98
struct dentry *h_dentry;
99
int wh_found, wh_able, opq, err;
99
int err, wh_found, opq;
100
unsigned char wh_able;
100
101
struct inode *h_dir, *h_inode, *inode;
101
102
struct qstr *name;
102
103
struct super_block *sb;
125
126
au_fset_ndx(ndx.flags, DIRPERM1);
126
127
LKTRTrace("nfsmnt %p\n", ndx.nfsmnt);
127
128
ndx.br = au_sbr(sb, bindex);
128
wh_able = au_br_whable(ndx.br->br_perm);
129
wh_able = !!au_br_whable(ndx.br->br_perm);
129
130
name = &dentry->d_name;
130
131
if (unlikely(wh_able))
131
132
wh_found = au_test_robr_wh(name, h_parent, wh_name,
208
209
int au_lkup_dentry(struct dentry *dentry, aufs_bindex_t bstart, mode_t type,
209
210
struct nameidata *nd)
211
int npositive, err, isdir;
212
213
struct dentry *parent;
213
214
aufs_bindex_t bindex, btail, bdiropq;
214
216
const struct qstr *name = &dentry->d_name;
215
217
struct qstr whname;
216
218
struct super_block *sb;
238
240
sb = dentry->d_sb;
239
241
mnt_flags = au_mntflags(sb);
240
242
inode = dentry->d_inode;
241
isdir = (inode && S_ISDIR(inode->i_mode));
243
isdir = !!(inode && S_ISDIR(inode->i_mode));
243
245
if (unlikely(au_test_dlgt(mnt_flags)))
244
246
au_fset_lkup(args.flags, DLGT);
537
539
/* #define TestingFuse */
538
static noinline_for_stack int
539
au_do_h_d_reval(struct dentry *dentry, aufs_bindex_t bindex,
540
struct nameidata *nd, struct dentry *h_dentry)
540
static noinline_for_stack
541
int au_do_h_d_reval(struct dentry *dentry, aufs_bindex_t bindex,
542
struct nameidata *nd, struct dentry *h_dentry)
542
544
int err, valid, e;
543
545
int (*reval)(struct dentry *, struct nameidata *);
599
static noinline_for_stack int
600
h_d_revalidate(struct dentry *dentry, struct inode *inode,
601
struct nameidata *nd, int do_udba)
601
static noinline_for_stack
602
int h_d_revalidate(struct dentry *dentry, struct inode *inode,
603
struct nameidata *nd, int do_udba)
603
int err, plus, locked, unhashed, is_root, h_plus;
604
606
aufs_bindex_t bindex, btail, bstart, ibs, ibe;
607
unsigned char plus, locked, unhashed, is_root, h_plus;
605
608
struct super_block *sb;
606
609
struct inode *first, *h_inode, *h_cached_inode;
607
610
umode_t mode, h_mode;
642
645
if (inode && S_ISDIR(inode->i_mode))
643
646
btail = au_dbtaildir(dentry);
644
locked = au_lock_nd(dentry, nd);
647
locked = !!au_lock_nd(dentry, nd);
645
648
for (bindex = bstart; bindex <= btail; bindex++) {
646
649
h_dentry = au_h_dptr(dentry, bindex);
657
660
if (unlikely(do_udba
659
&& (unhashed != d_unhashed(h_dentry)
662
&& (unhashed != !!d_unhashed(h_dentry)
660
663
|| name->len != h_dentry->d_name.len
661
664
|| memcmp(name->name, h_dentry->d_name.name,
690
694
if (inode && ibs <= bindex && bindex <= ibe)
691
695
h_cached_inode = au_h_iptr(inode, bindex);
693
LKTRTrace("{%d, 0%o, %d}, h{%d, 0%o, %d}\n",
694
plus, mode, !!h_cached_inode,
695
h_plus, h_mode, !!h_inode);
697
LKTRTrace("{%d, 0%o, %p}, h{%d, 0%o, %p}\n",
698
plus, mode, h_cached_inode,
699
h_plus, h_mode, h_inode);
696
700
if (unlikely(plus != h_plus
697
701
|| mode != h_mode
698
702
|| h_cached_inode != h_inode))
745
748
struct au_dpage *dpage;
746
749
struct dentry **dentries;
748
err = au_dpages_init(&dpages, GFP_TEMPORARY);
751
err = au_dpages_init(&dpages, GFP_NOFS);
750
753
err = au_dcsub_pages_rev(&dpages, parent, /*do_include*/1, NULL,
847
850
AuDebugOn(!dentry->d_fsdata);
854
aufs_read_lock(dentry, AuLock_FLUSH | AuLock_DW);
850
856
inode = dentry->d_inode;
852
si_read_lock(sb, AuLock_FLUSH);
854
857
sgen = au_sigen(sb);
855
if (au_digen(dentry) == sgen)
856
di_read_lock_child(dentry, !AuLock_IR);
858
if (unlikely(au_digen(dentry) != sgen)) {
858
859
AuDebugOn(IS_ROOT(dentry));
859
860
#ifdef ForceInotify
860
861
AuDbg("UDBA or digen, %.*s\n", AuDLNPair(dentry));
862
di_write_lock_child(dentry);
864
864
err = au_reval_dpath(dentry, sgen);
865
di_downgrade_lock(dentry, AuLock_IR);
866
865
if (unlikely(err))
869
ii_read_unlock(inode);
870
867
AuDebugOn(au_digen(dentry) != sgen);
874
if (au_iigen(inode) == sgen)
875
ii_read_lock_child(inode);
877
AuDebugOn(IS_ROOT(dentry));
869
if (unlikely(inode && au_iigen(inode) != sgen)) {
870
AuDebugOn(IS_ROOT(dentry));
878
871
#ifdef ForceInotify
879
AuDbg("UDBA or survived, %.*s\n", AuDLNPair(dentry));
872
AuDbg("UDBA or survived, %.*s\n", AuDLNPair(dentry));
881
ii_write_lock_child(inode);
882
err = au_refresh_hinode(inode, dentry);
883
ii_downgrade_lock(inode);
886
AuDebugOn(au_iigen(inode) != sgen);
874
err = au_refresh_hinode(inode, dentry);
877
AuDebugOn(au_iigen(inode) != sgen);
879
di_downgrade_lock(dentry, AuLock_IR);
890
881
#if 0 /* todo: support it? */
891
882
/* parent dir i_nlink is not updated in the case of setattr */
911
902
ndp = au_dup_nd(au_sbi(sb), &tmp_nd, nd);
906
nd->path.dentry = au_h_dptr(nd->path.dentry, bindex);
907
if (fake_nd->path.dentry) {
908
fake_nd->path.mnt = au_sbr_mnt(sb, bindex);
909
AuDebugOn(!fake_nd->path.mnt);
910
path_get(&fake_nd->path);
912
915
err = h_d_revalidate(dentry, inode, ndp, do_udba);
919
di_downgrade_lock(dentry, AuLock_IR);
915
922
au_store_fmode_exec(nd, inode);
918
ii_read_unlock(inode);
919
di_read_unlock(dentry, !AuLock_IR);
924
aufs_read_unlock(dentry, AuLock_IR);