1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 06_ubuntu.dpatch by Julian Andres Klode <juliank@ubuntu.com>
4
## DP: Fix problems with Ubuntu's kernel
7
diff -urNad aufs-0+20071211~/fs/aufs/cpup.c aufs-0+20071211/fs/aufs/cpup.c
8
--- aufs-0+20071211~/fs/aufs/cpup.c 2007-11-26 02:34:04.000000000 +0100
9
+++ aufs-0+20071211/fs/aufs/cpup.c 2007-12-11 19:18:51.000000000 +0100
12
/* keep the timestamps of the parent dir when cpup */
13
void au_dtime_store(struct au_dtime *dt, struct dentry *dentry,
14
- aufs_bindex_t bindex, struct dentry *h_dentry)
15
+ aufs_bindex_t bindex, struct dentry *h_dentry,
16
+ struct vfsmount *h_mnt)
22
dt->dt_dentry = dentry;
23
dt->dt_h_dentry = h_dentry;
24
+ dt->dt_h_mnt = h_mnt;
25
dt->dt_bindex = bindex;
26
inode = h_dentry->d_inode;
27
dt->dt_atime = inode->i_atime;
29
parent = dget_parent(dt->dt_dentry);
30
vfsub_ign_hinode(&vargs, IN_ATTRIB,
31
itohi(parent->d_inode, dt->dt_bindex));
32
- err = vfsub_notify_change(dt->dt_h_dentry, &attr, &vargs);
33
+ err = vfsub_notify_change(dt->dt_h_dentry, dt->dt_h_mnt, &attr,
37
- err = vfsub_notify_change(dt->dt_h_dentry, &attr, &vargs);
38
+ err = vfsub_notify_change(dt->dt_h_dentry, dt->dt_h_mnt, &attr,
41
AuWarn("restoring timestamps failed(%d). ignored\n", err);
44
/* ---------------------------------------------------------------------- */
46
-static int cpup_iattr(struct dentry *h_dst, struct dentry *h_src, int dlgt)
47
+static int cpup_iattr(struct dentry *h_dst, struct dentry *h_src,
48
+ struct vfsmount *h_dst_mnt, int dlgt)
53
sbits = !!(ia.ia_mode & (S_ISUID | S_ISGID));
55
vfsub_args_init(&vargs, NULL, dlgt, /*force_unlink*/0);
56
- err = vfsub_notify_change(h_dst, &ia, &vargs);
57
+ err = vfsub_notify_change(h_dst, h_dst_mnt, &ia, &vargs);
58
//if (LktrCond) err = -1;
60
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
62
if (!err && sbits && au_test_nfs(h_dst->d_sb)) {
63
ia.ia_valid = ATTR_FORCE | ATTR_MODE;
64
ia.ia_mode = h_isrc->i_mode;
65
- err = vfsub_notify_change(h_dst, &ia, &vargs);
66
+ err = vfsub_notify_change(h_dst, h_dst_mnt, &ia, &vargs);
72
/* stop updating while we copyup */
73
IMustLock(hidden[SRC].dentry->d_inode);
74
- err = au_copy_file(hidden[DST].file, hidden[SRC].file, len, sb);
75
+ err = au_copy_file(hidden[DST].file, hidden[SRC].file, len, sb,
79
fput(hidden[DST].file);
83
struct super_block *sb;
84
+ struct vfsmount *h_mnt;
85
struct vfsub_args vargs;
86
const int do_dt = flags->dtime;
90
AuDebugOn(bdst >= bsrc || au_test_ro(sb, bdst, NULL));
91
/* bsrc branch can be ro/rw. */
92
+ h_mnt = sbr_mnt(sb, bdst);
94
h_src = au_h_dptr_i(dentry, bsrc);
100
- au_dtime_store(&dt, parent, bdst, h_parent);
101
+ au_dtime_store(&dt, parent, bdst, h_parent, h_mnt);
103
mode = h_inode->i_mode;
104
switch (mode & S_IFMT) {
108
vfsub_args_init(&vargs, NULL, dlgt, 0);
109
- rerr = vfsub_unlink(h_dir, h_dst, &vargs);
110
+ rerr = vfsub_unlink(h_dir, h_dst, h_mnt,
113
AuIOErr("failed unlinking cpup-ed %.*s"
119
- err = vfsub_mkdir(h_dir, h_dst, mode, dlgt);
120
+ err = vfsub_mkdir(h_dir, h_dst, h_mnt, mode, dlgt);
121
//if (LktrCond) {vfs_rmdir(h_dir, h_dst); err = -1;}
123
/* setattr case: dir is not locked */
128
- err = vfsub_symlink(h_dir, h_dst, sym, mode, dlgt);
129
+ err = vfsub_symlink(h_dir, h_dst, h_mnt, sym, mode,
132
//{vfs_unlink(h_dir, h_dst); err = -1;}
138
- err = vfsub_mknod(h_dir, h_dst, mode, h_inode->i_rdev, dlgt);
139
+ err = vfsub_mknod(h_dir, h_dst, h_mnt, mode, h_inode->i_rdev,
141
//if (LktrCond) {vfs_unlink(h_dir, h_dst); err = -1;}
146
struct vfsub_args vargs;
147
struct aufs_sbinfo *sbinfo;
148
+ struct vfsmount *h_mnt;
150
LKTRTrace("%.*s, i%lu, bdst %d, bsrc %d, len %Ld, dtime %u\n",
151
AuDLNPair(dentry), dentry->d_inode->i_ino, bdst, bsrc, len,
153
dir = parent->d_inode;
156
+ h_mnt = sbr_mnt(sb, bdst);
157
dlgt = au_need_dlgt(sb);
158
dst_inode = au_h_iptr_i(inode, bdst);
159
if (unlikely(dst_inode)) {
163
AuDebugOn(!h_src->d_inode);
164
- err = vfsub_link(h_src, h_dir, h_dst, dlgt);
165
+ err = vfsub_link(h_src, h_mnt, h_dir, h_dst, h_mnt,
171
vfsub_i_lock_nested(dst_inode, AuLsc_I_CHILD2);
174
- err = cpup_iattr(h_dst, h_src, dlgt);
175
+ err = cpup_iattr(h_dst, h_src, h_mnt, dlgt);
176
//if (LktrCond) err = -1;
179
@@ -494,12 +508,12 @@
182
vfsub_i_unlock(dst_inode);
183
- au_dtime_store(&dt, parent, bdst, h_parent);
184
+ au_dtime_store(&dt, parent, bdst, h_parent, h_mnt);
185
vfsub_args_init(&vargs, NULL, dlgt, 0);
187
- rerr = vfsub_unlink(h_dir, h_dst, &vargs);
188
+ rerr = vfsub_unlink(h_dir, h_dst, h_mnt, &vargs);
190
- rerr = vfsub_rmdir(h_dir, h_dst, &vargs);
191
+ rerr = vfsub_rmdir(h_dir, h_dst, h_mnt, &vargs);
193
au_dtime_revert(&dt);
197
struct aufs_dinfo *dinfo;
198
aufs_bindex_t bstart;
199
+ struct vfsmount *h_mnt;
200
struct vfsub_args vargs;
201
struct aufs_ndx ndx = {
204
if (IS_ERR(wh_dentry))
207
- au_dtime_store(&dt, parent, bdst, h_parent);
208
+ h_mnt = sbr_mnt(sb, bdst);
209
+ au_dtime_store(&dt, parent, bdst, h_parent, h_mnt);
210
dinfo = dtodi(dentry);
211
bstart = dinfo->di_bstart;
212
h_dentry_bdst = dinfo->di_hdentry[0 + bdst].hd_dentry;
214
/* dget first to force sillyrename on nfs */
216
vfsub_args_init(&vargs, NULL, ndx.dlgt, 0);
217
- err = vfsub_unlink(h_dir, wh_dentry, &vargs);
218
+ err = vfsub_unlink(h_dir, wh_dentry, h_mnt, &vargs);
219
//if (LktrCond) err = -1;
221
AuIOErr("failed remove copied-up tmp file %.*s(%d)\n",
222
diff -urNad aufs-0+20071211~/fs/aufs/cpup.h aufs-0+20071211/fs/aufs/cpup.h
223
--- aufs-0+20071211~/fs/aufs/cpup.h 2007-11-12 02:39:39.000000000 +0100
224
+++ aufs-0+20071211/fs/aufs/cpup.h 2007-12-11 19:18:51.000000000 +0100
226
/* keep timestamps when copyup */
228
struct dentry *dt_dentry, *dt_h_dentry;
229
+ struct vfsmount *dt_h_mnt;
230
aufs_bindex_t dt_bindex;
231
struct timespec dt_atime, dt_mtime;
233
void au_dtime_store(struct au_dtime *dt, struct dentry *dentry,
234
- aufs_bindex_t bindex, struct dentry *h_dentry);
235
+ aufs_bindex_t bindex, struct dentry *h_dentry,
236
+ struct vfsmount *h_mnt);
237
void au_dtime_revert(struct au_dtime *dt);
239
#endif /* __KERNEL__ */
240
diff -urNad aufs-0+20071211~/fs/aufs/i_op.c aufs-0+20071211/fs/aufs/i_op.c
241
--- aufs-0+20071211~/fs/aufs/i_op.c 2007-11-26 02:34:25.000000000 +0100
242
+++ aufs-0+20071211/fs/aufs/i_op.c 2007-12-11 19:18:51.000000000 +0100
244
vfsub_ign_hinode(&vargs, events, itohi(dir, bcpup));
247
- err = vfsub_notify_change(h_dentry, ia, &vargs);
248
+ err = vfsub_notify_change(h_dentry, sbr_mnt(sb, bcpup), ia, &vargs);
251
au_cpup_attr_changeable(inode);
252
diff -urNad aufs-0+20071211~/fs/aufs/i_op_add.c aufs-0+20071211/fs/aufs/i_op_add.c
253
--- aufs-0+20071211~/fs/aufs/i_op_add.c 2007-12-10 02:19:07.000000000 +0100
254
+++ aufs-0+20071211/fs/aufs/i_op_add.c 2007-12-11 19:18:51.000000000 +0100
256
* if it failed, re-create the removed whiteout.
258
static int epilog(struct inode *dir, struct dentry *wh_dentry,
259
- struct dentry *dentry)
260
+ struct vfsmount *h_mnt, struct dentry *dentry)
265
h_dir = wh_dentry->d_parent->d_inode; /* dir inode is locked */
268
- err = au_unlink_wh_dentry(h_dir, wh_dentry, dentry, dir,
269
+ err = au_unlink_wh_dentry(h_dir, wh_dentry, h_mnt, dentry, dir,
274
h_dir = h_parent->d_inode;
275
hdir_lock(h_dir, dir, bcpup);
277
- au_dtime_store(dt, parent, bcpup, h_parent);
278
+ au_dtime_store(dt, parent, bcpup, h_parent,
279
+ sbr_mnt(parent->d_sb, bcpup));
281
if (/* bcpup != bstart || */ bcpup != dbwh(dentry))
282
goto out; /* success */
285
struct vfsub_args vargs;
286
struct super_block *sb;
287
+ struct vfsmount *h_mnt;
288
struct au_wr_dir_args wr_dir_args = {
294
dlgt = au_need_dlgt(sb);
295
+ h_mnt = sbr_mnt(sb, dbstart(dentry));
297
#if 1 // partial testing
299
@@ -203,11 +206,11 @@
300
arg->u.c.nd, au_nfsmnt(sb, dbstart(dentry)));
303
- err = vfsub_symlink(h_dir, h_dentry,
304
+ err = vfsub_symlink(h_dir, h_dentry, h_mnt,
305
arg->u.s.symname, S_IALLUGO, dlgt);
308
- err = vfsub_mknod(h_dir, h_dentry,
309
+ err = vfsub_mknod(h_dir, h_dentry, h_mnt,
310
arg->u.m.mode, arg->u.m.dev, dlgt);
313
@@ -217,14 +220,14 @@
317
- err = epilog(dir, wh_dentry, dentry);
318
+ err = epilog(dir, wh_dentry, h_mnt, dentry);
322
if (unlikely(err && h_dentry->d_inode)) {
324
vfsub_args_init(&vargs, NULL, dlgt, 0);
325
- rerr = vfsub_unlink(h_dir, h_dentry, &vargs);
326
+ rerr = vfsub_unlink(h_dir, h_dentry, h_mnt, &vargs);
329
AuIOErr("%.*s revert failure(%d, %d)\n",
331
aufs_bindex_t bstart;
332
struct super_block *sb;
333
struct au_cpup_flags cflags;
334
+ struct vfsmount *h_mnt;
339
h_inode = h_dentry->d_inode;
340
bstart = ibstart(inode);
342
- if (bstart <= a->bdst)
344
+ if (bstart <= a->bdst) {
345
h_dst_inode = au_h_iptr_i(inode, a->bdst);
346
+ h_mnt = sbr_mnt(sb, a->bdst);
349
if (!h_dst_inode || !h_dst_inode->i_nlink) {
350
/* copyup src_dentry as the name of dentry. */
352
/* the inode of src_dentry already exists on a.bdst branch */
353
h_dentry = d_find_alias(h_dst_inode);
355
- err = vfsub_link(h_dentry, a->h_dir,
356
- a->h_dentry, a->dlgt);
357
+ err = vfsub_link(h_dentry, h_mnt, a->h_dir, a->h_dentry,
361
AuIOErr("no dentry found for i%lu on b%d\n",
365
struct super_block *sb;
366
+ struct vfsmount *h_mnt;
367
struct vfsub_args vargs;
368
struct au_wr_dir_args wr_dir_args = {
371
a.bsrc = dbstart(src_dentry);
372
a.bdst = dbstart(dentry);
373
h_src_dentry = au_h_dptr(src_dentry);
374
+ h_mnt = sbr_mnt(sb, a.bdst);
375
if (unlikely(!AuFlag(stosi(sb), f_plink))) {
377
* copyup src_dentry to the branch we process,
379
err = cpup_before_link(src_dentry, dir, &a);
381
h_src_dentry = au_h_dptr(src_dentry);
382
- err = vfsub_link(h_src_dentry, a.h_dir,
383
- a.h_dentry, a.dlgt);
384
+ err = vfsub_link(h_src_dentry, h_mnt, a.h_dir,
385
+ a.h_dentry, h_mnt, a.dlgt);
389
@@ -463,15 +472,15 @@
390
err = cpup_or_link(src_dentry, &a);
392
h_src_dentry = au_h_dptr(src_dentry);
393
- err = vfsub_link(h_src_dentry, a.h_dir,
394
- a.h_dentry, a.dlgt);
395
+ err = vfsub_link(h_src_dentry, h_mnt, a.h_dir,
396
+ a.h_dentry, h_mnt, a.dlgt);
403
- err = au_unlink_wh_dentry(a.h_dir, wh_dentry, dentry,
404
+ err = au_unlink_wh_dentry(a.h_dir, wh_dentry, h_mnt, dentry,
411
vfsub_args_init(&vargs, NULL, a.dlgt, 0);
412
- rerr = vfsub_unlink(a.h_dir, a.h_dentry, &vargs);
413
+ rerr = vfsub_unlink(a.h_dir, a.h_dentry, h_mnt, &vargs);
419
aufs_bindex_t bindex;
420
struct super_block *sb;
421
+ struct vfsmount *h_mnt;
422
struct vfsub_args vargs;
423
struct au_wr_dir_args wr_dir_args = {
426
h_dir = h_parent->d_inode;
428
dlgt = au_need_dlgt(sb);
429
+ h_mnt = sbr_mnt(sb, bindex);
431
- err = vfsub_mkdir(h_dir, h_dentry, mode, dlgt);
432
+ err = vfsub_mkdir(h_dir, h_dentry, h_mnt, mode, dlgt);
440
- err = epilog(dir, wh_dentry, dentry);
441
+ err = epilog(dir, wh_dentry, h_mnt, dentry);
447
LKTRLabel(revert dir);
448
vfsub_args_init(&vargs, NULL, dlgt, 0);
449
- rerr = vfsub_rmdir(h_dir, h_dentry, &vargs);
450
+ rerr = vfsub_rmdir(h_dir, h_dentry, h_mnt, &vargs);
453
AuIOErr("%.*s reverting dir failed(%d, %d)\n",
454
diff -urNad aufs-0+20071211~/fs/aufs/i_op_del.c aufs-0+20071211/fs/aufs/i_op_del.c
455
--- aufs-0+20071211~/fs/aufs/i_op_del.c 2007-11-19 02:07:10.000000000 +0100
456
+++ aufs-0+20071211/fs/aufs/i_op_del.c 2007-12-11 19:18:51.000000000 +0100
458
h_parent = au_h_dptr_i(parent, *bcpup);
459
h_dir = h_parent->d_inode;
460
hdir_lock(h_dir, dir, *bcpup);
461
- au_dtime_store(dt, parent, *bcpup, h_parent);
462
+ au_dtime_store(dt, parent, *bcpup, h_parent,
463
+ sbr_mnt(dentry->d_sb, *bcpup));
466
goto out; /* success, no need to create whiteout */
467
@@ -212,16 +213,17 @@
471
-static int do_revert(int err, struct dentry *wh_dentry, struct dentry *dentry,
472
- aufs_bindex_t bwh, struct au_dtime *dt,
473
- struct revert_flags *flags)
474
+static int do_revert(int err, struct dentry *wh_dentry, struct vfsmount *h_mnt,
475
+ struct dentry *dentry, aufs_bindex_t bwh,
476
+ struct au_dtime *dt, struct revert_flags *flags)
481
dir = wh_dentry->d_parent->d_inode; /* dir inode is locked */
483
- rerr = au_unlink_wh_dentry(dir, wh_dentry, dentry, dir, !!flags->dlgt);
484
+ rerr = au_unlink_wh_dentry(dir, wh_dentry, h_mnt, dentry, dir,
488
set_dbwh(dentry, bwh);
491
aufs_bindex_t bwh, bindex, bstart;
492
struct super_block *sb;
493
+ struct vfsmount *h_mnt;
494
struct vfsub_args vargs;
496
LKTRTrace("i%lu, %.*s\n", dir->i_ino, AuDLNPair(dentry));
497
@@ -270,12 +273,13 @@
498
dlgt = au_need_dlgt(sb);
499
h_dentry = au_h_dptr(dentry);
501
+ h_mnt = sbr_mnt(sb, dbstart(dentry));
503
if (bindex == bstart) {
504
vfsub_args_init(&vargs, NULL, dlgt, 0);
505
h_dir = h_dentry->d_parent->d_inode; /* dir inode is locked */
507
- err = vfsub_unlink(h_dir, h_dentry, &vargs);
508
+ err = vfsub_unlink(h_dir, h_dentry, h_mnt, &vargs);
511
/* dir inode is locked */
513
struct revert_flags rev_flags = {
516
- rerr = do_revert(err, wh_dentry, dentry, bwh, &dt, &rev_flags);
517
+ rerr = do_revert(err, wh_dentry, h_mnt, dentry, bwh, &dt,
523
struct rmdir_whtmp_args *args;
524
struct aufs_nhash *whlist;
525
struct super_block *sb;
526
+ struct vfsmount *h_mnt;
528
LKTRTrace("i%lu, %.*s\n", dir->i_ino, AuDLNPair(dentry));
532
h_dentry = au_h_dptr(dentry);
534
+ h_mnt = sbr_mnt(dentry->d_sb, dbstart(dentry));
537
if (bindex == bstart) {
539
struct revert_flags rev_flags = {
540
.dlgt = au_need_dlgt(sb)
542
- rerr = do_revert(err, wh_dentry, dentry, bwh, &dt, &rev_flags);
543
+ rerr = do_revert(err, wh_dentry, h_mnt, dentry, bwh, &dt,
548
diff -urNad aufs-0+20071211~/fs/aufs/i_op_ren.c aufs-0+20071211/fs/aufs/i_op_ren.c
549
--- aufs-0+20071211~/fs/aufs/i_op_ren.c 2007-11-19 02:09:25.000000000 +0100
550
+++ aufs-0+20071211/fs/aufs/i_op_ren.c 2007-12-11 19:18:51.000000000 +0100
552
struct aufs_nhash whlist;
553
aufs_bindex_t btgt, bstart[2];
554
struct super_block *sb;
555
+ struct vfsmount *h_mnt;
557
unsigned int isdir:1;
558
unsigned int issamedir:1;
560
if (unlikely(a->udba && a->isdir))
561
vfsub_ign_hinode(&vargs, IN_MOVE_SELF,
562
itohi(src_dentry->d_inode, a->btgt));
563
- err = vfsub_rename(h_dir[SRC], au_h_dptr(src_dentry),
564
- h_dir[DST], a->h_dentry[DST], &vargs);
565
+ err = vfsub_rename(h_dir[SRC], au_h_dptr(src_dentry), a->h_mnt,
566
+ h_dir[DST], a->h_dentry[DST], a->h_mnt,
573
/* remove whiteout for dentry */
574
if (wh_dentry[DST]) {
575
- err = au_unlink_wh_dentry(h_dir[DST], wh_dentry[DST],
576
+ err = au_unlink_wh_dentry(h_dir[DST], wh_dentry[DST], a->h_mnt,
577
dentry, dir, /*dlgt*/0);
581
vfsub_ign_hinode(&vargs, IN_MOVE_SELF,
582
itohi(src_dentry->d_inode, a->btgt));
584
- (h_dir[DST], au_h_dptr_i(src_dentry, a->btgt),
585
- h_dir[SRC], d, &vargs);
586
+ (h_dir[DST], au_h_dptr_i(src_dentry, a->btgt), a->h_mnt,
587
+ h_dir[SRC], d, a->h_mnt, &vargs);
592
RevertFailure("rename %.*s", AuDLNPair(src_dentry));
594
vfsub_args_init(&vargs, NULL, a->dlgt, 0);
595
- rerr = vfsub_unlink(h_dir[DST], a->h_dentry[DST], &vargs);
596
+ rerr = vfsub_unlink(h_dir[DST], a->h_dentry[DST], a->h_mnt,
599
set_h_dptr(src_dentry, a->btgt, NULL);
600
set_dbstart(src_dentry, a->bstart[SRC]);
602
if (unlikely(0 && a->udba && a->isdir))
603
vfsub_ign_hinode(&vargs, IN_MOVE_SELF,
604
itohi(dentry->d_inode, a->btgt));
605
- rerr = vfsub_rename(h_dir[DST], h_dst, h_dir[DST], d, &vargs);
606
+ rerr = vfsub_rename(h_dir[DST], h_dst, a->h_mnt, h_dir[DST], d,
613
if (wh_dentry[SRC]) {
615
- rerr = au_unlink_wh_dentry(h_dir[SRC], wh_dentry[SRC],
616
+ rerr = au_unlink_wh_dentry(h_dir[SRC], wh_dentry[SRC], a->h_mnt,
617
src_dentry, src_dir, /*dlgt*/0);
624
+ p->a.h_mnt = sbr_mnt(p->a.sb, p->a.btgt);
625
p->a.h_parent[SRC] = au_h_dptr_i(p->a.parent[SRC], p->a.btgt);
626
p->a.h_parent[DST] = au_h_dptr_i(p->a.parent[DST], p->a.btgt);
628
@@ -539,18 +544,18 @@
630
/* store timestamps to be revertible */
631
au_dtime_store(p->dt[PARENT] + SRC, p->a.parent[SRC], p->a.btgt,
632
- p->a.h_parent[SRC]);
633
+ p->a.h_parent[SRC], p->a.h_mnt);
635
au_dtime_store(p->dt[PARENT] + DST, p->a.parent[DST], p->a.btgt,
636
- p->a.h_parent[DST]);
637
+ p->a.h_parent[DST], p->a.h_mnt);
640
au_dtime_store(p->dt[CHILD] + SRC, src_dentry, p->a.btgt,
641
- p->a.h_dentry[SRC]);
642
+ p->a.h_dentry[SRC], p->a.h_mnt);
643
if (p->a.h_dentry[DST]->d_inode) {
645
au_dtime_store(p->dt[CHILD] + DST, dentry, p->a.btgt,
646
- p->a.h_dentry[DST]);
647
+ p->a.h_dentry[DST], p->a.h_mnt);
651
diff -urNad aufs-0+20071211~/fs/aufs/misc.c aufs-0+20071211/fs/aufs/misc.c
652
--- aufs-0+20071211~/fs/aufs/misc.c 2007-11-12 02:40:06.000000000 +0100
653
+++ aufs-0+20071211/fs/aufs/misc.c 2007-12-11 19:18:51.000000000 +0100
655
/* ---------------------------------------------------------------------- */
657
int au_copy_file(struct file *dst, struct file *src, loff_t len,
658
- struct super_block *sb)
659
+ struct super_block *sb, struct vfsmount *dst_mnt)
662
unsigned long blksize;
664
ia->ia_valid = ATTR_SIZE | ATTR_FILE;
666
vfsub_i_lock_nested(h_i, AuLsc_I_CHILD2);
667
- err = vfsub_notify_change(h_d, ia, &vargs);
668
+ err = vfsub_notify_change(h_d, dst_mnt, ia, &vargs);
672
diff -urNad aufs-0+20071211~/fs/aufs/misc.h aufs-0+20071211/fs/aufs/misc.h
673
--- aufs-0+20071211~/fs/aufs/misc.h 2007-11-12 02:40:06.000000000 +0100
674
+++ aufs-0+20071211/fs/aufs/misc.h 2007-12-11 19:18:51.000000000 +0100
676
int dlgt, struct nameidata *nd, struct vfsmount *nfsmnt);
678
int au_copy_file(struct file *dst, struct file *src, loff_t len,
679
- struct super_block *sb);
680
+ struct super_block *sb, struct vfsmount *dst_mnt);
681
int au_test_ro(struct super_block *sb, aufs_bindex_t bindex,
682
struct inode *inode);
683
int au_test_perm(struct inode *h_inode, int mask, int dlgt);
684
diff -urNad aufs-0+20071211~/fs/aufs/plink.c aufs-0+20071211/fs/aufs/plink.c
685
--- aufs-0+20071211~/fs/aufs/plink.c 2007-10-29 05:41:10.000000000 +0100
686
+++ aufs-0+20071211/fs/aufs/plink.c 2007-12-11 19:18:51.000000000 +0100
690
static int do_whplink(char *tgt, int len, struct dentry *h_parent,
691
- struct dentry *h_dentry, struct vfsmount *nfsmnt,
692
- struct super_block *sb)
693
+ struct dentry *h_dentry, struct vfsmount *h_mnt,
694
+ struct vfsmount *nfsmnt, struct super_block *sb)
697
struct dentry *h_tgt;
699
vfsub_args_init(&vargs, NULL, ndx.dlgt, 0);
700
h_dir = h_parent->d_inode;
701
if (unlikely(h_tgt->d_inode && h_tgt->d_inode != h_dentry->d_inode))
702
- err = vfsub_unlink(h_dir, h_tgt, &vargs);
703
+ err = vfsub_unlink(h_dir, h_tgt, h_mnt, &vargs);
704
if (!err && !h_tgt->d_inode) {
705
- err = vfsub_link(h_dentry, h_dir, h_tgt, ndx.dlgt);
706
+ err = vfsub_link(h_dentry, h_mnt, h_dir, h_tgt, h_mnt, ndx.dlgt);
712
struct dentry *h_parent;
713
struct dentry *h_dentry;
714
+ struct vfsmount *h_mnt;
715
struct vfsmount *nfsmnt;
716
struct super_block *sb;
720
struct do_whplink_args *a = args;
721
*a->errp = do_whplink(a->tgt, a->len, a->h_parent, a->h_dentry,
723
+ a->h_mnt, a->nfsmnt, a->sb);
726
static int whplink(struct dentry *h_dentry, struct inode *inode,
729
.h_parent = h_parent,
730
.h_dentry = h_dentry,
731
+ .h_mnt = br->br_mnt,
732
.nfsmnt = au_do_nfsmnt(br->br_mnt),
738
err = do_whplink(tgtname, len, h_parent, h_dentry,
739
- au_do_nfsmnt(br->br_mnt), sb);
740
+ br->br_mnt, au_do_nfsmnt(br->br_mnt), sb);
741
vfsub_i_unlock(h_dir);
744
diff -urNad aufs-0+20071211~/fs/aufs/vfsub.c aufs-0+20071211/fs/aufs/vfsub.c
745
--- aufs-0+20071211~/fs/aufs/vfsub.c 2007-12-10 02:20:14.000000000 +0100
746
+++ aufs-0+20071211/fs/aufs/vfsub.c 2007-12-11 19:18:51.000000000 +0100
750
struct dentry *dentry;
751
+ struct vfsmount *mnt;
755
@@ -163,20 +164,22 @@
756
static void call_symlink(void *args)
758
struct symlink_args *a = args;
759
- *a->errp = do_vfsub_symlink(a->dir, a->dentry, a->symname, a->mode);
760
+ *a->errp = do_vfsub_symlink(a->dir, a->dentry, a->mnt, a->symname,
764
-int vfsub_symlink(struct inode *dir, struct dentry *dentry, const char *symname,
765
- int mode, int dlgt)
766
+int vfsub_symlink(struct inode *dir, struct dentry *dentry,
767
+ struct vfsmount *mnt, const char *symname, int mode, int dlgt)
770
- return do_vfsub_symlink(dir, dentry, symname, mode);
771
+ return do_vfsub_symlink(dir, dentry, mnt, symname, mode);
774
struct symlink_args args = {
785
struct dentry *dentry;
786
+ struct vfsmount *mnt;
790
@@ -198,20 +202,21 @@
791
static void call_mknod(void *args)
793
struct mknod_args *a = args;
794
- *a->errp = do_vfsub_mknod(a->dir, a->dentry, a->mode, a->dev);
795
+ *a->errp = do_vfsub_mknod(a->dir, a->dentry, a->mnt, a->mode, a->dev);
798
-int vfsub_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev,
800
+int vfsub_mknod(struct inode *dir, struct dentry *dentry, struct vfsmount *mnt,
801
+ int mode, dev_t dev, int dlgt)
804
- return do_vfsub_mknod(dir, dentry, mode, dev);
805
+ return do_vfsub_mknod(dir, dentry, mnt, mode, dev);
808
struct mknod_args args = {
816
@@ -226,25 +231,28 @@
819
struct dentry *dentry;
820
+ struct vfsmount *mnt;
824
static void call_mkdir(void *args)
826
struct mkdir_args *a = args;
827
- *a->errp = do_vfsub_mkdir(a->dir, a->dentry, a->mode);
828
+ *a->errp = do_vfsub_mkdir(a->dir, a->dentry, a->mnt, a->mode);
831
-int vfsub_mkdir(struct inode *dir, struct dentry *dentry, int mode, int dlgt)
832
+int vfsub_mkdir(struct inode *dir, struct dentry *dentry, struct vfsmount *mnt,
833
+ int mode, int dlgt)
836
- return do_vfsub_mkdir(dir, dentry, mode);
837
+ return do_vfsub_mkdir(dir, dentry, mnt, mode);
840
struct mkdir_args args = {
847
wkq_err = au_wkq_wait(call_mkdir, &args, /*dlgt*/1);
851
struct dentry *src_dentry, *dentry;
852
+ struct vfsmount *src_mnt, *mnt;
855
static void call_link(void *args)
856
@@ -268,18 +277,21 @@
857
*a->errp = do_vfsub_link(a->src_dentry, a->dir, a->dentry);
860
-int vfsub_link(struct dentry *src_dentry, struct inode *dir,
861
- struct dentry *dentry, int dlgt)
862
+int vfsub_link(struct dentry *src_dentry, struct vfsmount *src_mnt,
863
+ struct inode *dir, struct dentry *dentry,
864
+ struct vfsmount *mnt, int dlgt)
867
- return do_vfsub_link(src_dentry, dir, dentry);
868
+ return do_vfsub_link(src_dentry, src_mnt, dir, dentry, mnt);
871
struct link_args args = {
873
.src_dentry = src_dentry,
874
+ .src_mnt = src_mnt,
880
wkq_err = au_wkq_wait(call_link, &args, /*dlgt*/1);
881
if (unlikely(wkq_err))
884
struct inode *src_dir, *dir;
885
struct dentry *src_dentry, *dentry;
886
+ struct vfsmount *src_mnt, *mnt;
887
struct vfsub_args *vargs;
890
@@ -299,21 +312,23 @@
892
struct rename_args *a = args;
893
vfsub_ignore(a->vargs);
894
- *a->errp = do_vfsub_rename(a->src_dir, a->src_dentry, a->dir,
896
+ *a->errp = do_vfsub_rename(a->src_dir, a->src_dentry, a->src_mnt,
897
+ a->dir, a->dentry, a->mnt);
898
if (unlikely(*a->errp))
899
vfsub_unignore(a->vargs);
902
int vfsub_rename(struct inode *src_dir, struct dentry *src_dentry,
903
- struct inode *dir, struct dentry *dentry,
904
+ struct vfsmount *src_mnt,
905
+ struct inode *dir, struct dentry *dentry, struct vfsmount *mnt,
906
struct vfsub_args *vargs)
912
- err = do_vfsub_rename(src_dir, src_dentry, dir, dentry);
913
+ err = do_vfsub_rename(src_dir, src_dentry, src_mnt, dir, dentry,
916
vfsub_unignore(vargs);
921
.src_dentry = src_dentry,
922
+ .src_mnt = src_mnt,
928
wkq_err = au_wkq_wait(call_rename, &args, /*dlgt*/1);
932
struct dentry *dentry;
933
+ struct vfsmount *mnt;
934
struct vfsub_args *vargs;
937
@@ -344,19 +362,19 @@
939
struct rmdir_args *a = args;
940
vfsub_ignore(a->vargs);
941
- *a->errp = do_vfsub_rmdir(a->dir, a->dentry);
942
+ *a->errp = do_vfsub_rmdir(a->dir, a->dentry, a->mnt);
943
if (unlikely(*a->errp))
944
vfsub_unignore(a->vargs);
947
-int vfsub_rmdir(struct inode *dir, struct dentry *dentry,
948
+int vfsub_rmdir(struct inode *dir, struct dentry *dentry, struct vfsmount *mnt,
949
struct vfsub_args *vargs)
955
- err = do_vfsub_rmdir(dir, dentry);
956
+ err = do_vfsub_rmdir(dir, dentry, mnt);
958
vfsub_unignore(vargs);
967
wkq_err = au_wkq_wait(call_rmdir, &args, /*dlgt*/1);
971
struct dentry *dentry;
972
+ struct vfsmount *mnt;
976
@@ -769,11 +789,11 @@
977
static void au_call_vfsub_mkdir(void *args)
979
struct au_vfsub_mkdir_args *a = args;
980
- *a->errp = vfsub_mkdir(a->dir, a->dentry, a->mode, a->dlgt);
981
+ *a->errp = vfsub_mkdir(a->dir, a->dentry, a->mnt, a->mode, a->dlgt);
984
-int vfsub_sio_mkdir(struct inode *dir, struct dentry *dentry, int mode,
986
+int vfsub_sio_mkdir(struct inode *dir, struct dentry *dentry,
987
+ struct vfsmount *mnt, int mode, int dlgt)
989
int err, do_sio, wkq_err;
991
@@ -781,12 +801,13 @@
993
do_sio = au_test_perm(dir, MAY_EXEC | MAY_WRITE, dlgt);
995
- err = vfsub_mkdir(dir, dentry, mode, dlgt);
996
+ err = vfsub_mkdir(dir, dentry, mnt, mode, dlgt);
998
struct au_vfsub_mkdir_args args = {
1006
@@ -803,16 +824,18 @@
1009
struct dentry *dentry;
1010
+ struct vfsmount *mnt;
1011
struct vfsub_args *vargs;
1014
static void au_call_vfsub_rmdir(void *args)
1016
struct au_vfsub_rmdir_args *a = args;
1017
- *a->errp = vfsub_rmdir(a->dir, a->dentry, a->vargs);
1018
+ *a->errp = vfsub_rmdir(a->dir, a->dentry, a->mnt, a->vargs);
1021
-int vfsub_sio_rmdir(struct inode *dir, struct dentry *dentry, int dlgt)
1022
+int vfsub_sio_rmdir(struct inode *dir, struct dentry *dentry,
1023
+ struct vfsmount *mnt, int dlgt)
1025
int err, do_sio, wkq_err;
1026
struct vfsub_args vargs;
1027
@@ -822,12 +845,13 @@
1028
vfsub_args_init(&vargs, /*ign*/NULL, dlgt, /*force_unlink*/0);
1029
do_sio = au_test_perm(dir, MAY_EXEC | MAY_WRITE, dlgt);
1031
- err = vfsub_rmdir(dir, dentry, &vargs);
1032
+ err = vfsub_rmdir(dir, dentry, mnt, &vargs);
1034
struct au_vfsub_rmdir_args args = {
1041
wkq_err = au_wkq_wait(au_call_vfsub_rmdir, &args, /*dlgt*/0);
1043
struct notify_change_args {
1045
struct dentry *h_dentry;
1046
+ struct vfsmount *h_mnt;
1048
struct vfsub_args *vargs;
1051
if (!IS_IMMUTABLE(h_inode) && !IS_APPEND(h_inode)) {
1052
vfsub_ignore(a->vargs);
1054
- *a->errp = notify_change(a->h_dentry, a->ia);
1055
+ *a->errp = notify_change(a->h_dentry, a->h_mnt, a->ia);
1058
au_update_fuse_h_inode(NULL, a->h_dentry); /*ignore*/
1059
@@ -872,13 +897,14 @@
1060
AuTraceErr(*a->errp);
1063
-int vfsub_notify_change(struct dentry *dentry, struct iattr *ia,
1064
- struct vfsub_args *vargs)
1065
+int vfsub_notify_change(struct dentry *dentry, struct vfsmount *mnt,
1066
+ struct iattr *ia, struct vfsub_args *vargs)
1069
struct notify_change_args args = {
1079
struct dentry *dentry;
1080
+ struct vfsmount *mnt;
1081
struct vfsub_args *vargs;
1088
- *a->errp = do_vfsub_unlink(a->dir, a->dentry);
1089
+ *a->errp = do_vfsub_unlink(a->dir, a->dentry, a->mnt);
1092
if (!stop_sillyrename)
1094
* @dir: must be locked.
1095
* @dentry: target dentry.
1097
-int vfsub_unlink(struct inode *dir, struct dentry *dentry,
1098
+int vfsub_unlink(struct inode *dir, struct dentry *dentry, struct vfsmount *mnt,
1099
struct vfsub_args *vargs)
1110
diff -urNad aufs-0+20071211~/fs/aufs/vfsub.h aufs-0+20071211/fs/aufs/vfsub.h
1111
--- aufs-0+20071211~/fs/aufs/vfsub.h 2007-11-12 02:43:10.000000000 +0100
1112
+++ aufs-0+20071211/fs/aufs/vfsub.h 2007-12-11 19:18:51.000000000 +0100
1116
int do_vfsub_symlink(struct inode *dir, struct dentry *dentry,
1117
- const char *symname, int mode)
1118
+ struct vfsmount *mnt, const char *symname, int mode)
1123
dir->i_ino, AuDLNPair(dentry), symname, mode);
1126
- err = vfs_symlink(dir, dentry, symname, mode);
1127
+ err = vfs_symlink(dir, dentry, mnt, symname, mode);
1129
/* dir inode is locked */
1130
au_update_fuse_h_inode(NULL, dentry->d_parent); /*ignore*/
1131
@@ -355,15 +355,15 @@
1135
-int do_vfsub_mknod(struct inode *dir, struct dentry *dentry, int mode,
1137
+int do_vfsub_mknod(struct inode *dir, struct dentry *dentry,
1138
+ struct vfsmount *mnt, int mode, dev_t dev)
1142
LKTRTrace("i%lu, %.*s, 0x%x\n", dir->i_ino, AuDLNPair(dentry), mode);
1145
- err = vfs_mknod(dir, dentry, mode, dev);
1146
+ err = vfs_mknod(dir, dentry, mnt, mode, dev);
1148
/* dir inode is locked */
1149
au_update_fuse_h_inode(NULL, dentry->d_parent); /*ignore*/
1154
-int do_vfsub_link(struct dentry *src_dentry, struct inode *dir,
1155
- struct dentry *dentry)
1156
+int do_vfsub_link(struct dentry *src_dentry, struct vfsmount *src_mnt,
1157
+ struct inode *dir, struct dentry *dentry,
1158
+ struct vfsmount *mnt)
1166
- err = vfs_link(src_dentry, dir, dentry);
1167
+ err = vfs_link(src_dentry, src_mnt, dir, dentry, mnt);
1170
LKTRTrace("src_i %p, dst_i %p\n",
1174
int do_vfsub_rename(struct inode *src_dir, struct dentry *src_dentry,
1175
- struct inode *dir, struct dentry *dentry)
1176
+ struct vfsmount *src_mnt,
1177
+ struct inode *dir, struct dentry *dentry,
1178
+ struct vfsmount *mnt)
1186
- err = vfs_rename(src_dir, src_dentry, dir, dentry);
1187
+ err = vfs_rename(src_dir, src_dentry, src_mnt, dir, dentry, mnt);
1190
/* dir inode is locked */
1191
@@ -422,14 +425,15 @@
1195
-int do_vfsub_mkdir(struct inode *dir, struct dentry *dentry, int mode)
1196
+int do_vfsub_mkdir(struct inode *dir, struct dentry *dentry,
1197
+ struct vfsmount *mnt, int mode)
1201
LKTRTrace("i%lu, %.*s, 0x%x\n", dir->i_ino, AuDLNPair(dentry), mode);
1204
- err = vfs_mkdir(dir, dentry, mode);
1205
+ err = vfs_mkdir(dir, dentry, mnt, mode);
1207
/* dir inode is locked */
1208
au_update_fuse_h_inode(NULL, dentry->d_parent); /*ignore*/
1213
-static inline int do_vfsub_rmdir(struct inode *dir, struct dentry *dentry)
1214
+static inline int do_vfsub_rmdir(struct inode *dir, struct dentry *dentry,
1215
+ struct vfsmount *mnt)
1223
- err = vfs_rmdir(dir, dentry);
1224
+ err = vfs_rmdir(dir, dentry, mnt);
1226
/* dir inode is locked */
1232
-static inline int do_vfsub_unlink(struct inode *dir, struct dentry *dentry)
1233
+static inline int do_vfsub_unlink(struct inode *dir, struct dentry *dentry,
1234
+ struct vfsmount *mnt)
1240
/* vfs_unlink() locks inode */
1242
- err = vfs_unlink(dir, dentry);
1243
+ err = vfs_unlink(dir, dentry, mnt);
1245
/* dir inode is locked */
1247
@@ -689,54 +695,57 @@
1251
-int vfsub_symlink(struct inode *dir, struct dentry *dentry, const char *symname,
1252
- int mode, int dlgt)
1253
+int vfsub_symlink(struct inode *dir, struct dentry *dentry,
1254
+ struct vfsmount *mnt, const char *symname, int mode, int dlgt)
1256
- return do_vfsub_symlink(dir, dentry, symname, mode);
1257
+ return do_vfsub_symlink(dir, dentry, mnt, symname, mode);
1261
-int vfsub_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev,
1263
+int vfsub_mknod(struct inode *dir, struct dentry *dentry, struct vfsmount *mnt,
1264
+ int mode, dev_t dev, int dlgt)
1266
- return do_vfsub_mknod(dir, dentry, mode, dev);
1267
+ return do_vfsub_mknod(dir, dentry, mnt, mode, dev);
1271
-int vfsub_link(struct dentry *src_dentry, struct inode *dir,
1272
- struct dentry *dentry, int dlgt)
1273
+int vfsub_link(struct dentry *src_dentry, struct vfsmount *src_mnt,
1274
+ struct inode *dir, struct dentry *dentry, struct vfsmount *mnt,
1277
- return do_vfsub_link(src_dentry, dir, dentry);
1278
+ return do_vfsub_link(src_dentry, src_mnt, dir, dentry, mnt);
1282
int vfsub_rename(struct inode *src_dir, struct dentry *src_dentry,
1283
- struct inode *dir, struct dentry *dentry,
1284
+ struct vfsmount *src_mnt,
1285
+ struct inode *dir, struct dentry *dentry, struct vfsmount *mnt,
1286
struct vfsub_args *vargs)
1290
vfsub_ignore(vargs);
1291
- err = do_vfsub_rename(src_dir, src_dentry, dir, dentry);
1292
+ err = do_vfsub_rename(src_dir, src_dentry, src_mnt, dir, dentry, mnt);
1294
vfsub_unignore(vargs);
1299
-int vfsub_mkdir(struct inode *dir, struct dentry *dentry, int mode, int dlgt)
1300
+int vfsub_mkdir(struct inode *dir, struct dentry *dentry, struct vfsmount *mnt,
1301
+ int mode, int dlgt)
1303
- return do_vfsub_mkdir(dir, dentry, mode);
1304
+ return do_vfsub_mkdir(dir, dentry, mnt, mode);
1308
-int vfsub_rmdir(struct inode *dir, struct dentry *dentry,
1309
+int vfsub_rmdir(struct inode *dir, struct dentry *dentry, struct vfsmount *mnt,
1310
struct vfsub_args *vargs)
1314
vfsub_ignore(vargs);
1315
- err = do_vfsub_rmdir(dir, dentry);
1316
+ err = do_vfsub_rmdir(dir, dentry, mnt);
1318
vfsub_unignore(vargs);
1320
@@ -819,15 +828,16 @@
1322
/* ---------------------------------------------------------------------- */
1324
-int vfsub_sio_mkdir(struct inode *dir, struct dentry *dentry, int mode,
1326
-int vfsub_sio_rmdir(struct inode *dir, struct dentry *dentry, int dlgt);
1327
+int vfsub_sio_mkdir(struct inode *dir, struct dentry *dentry,
1328
+ struct vfsmount *mnt, int mode, int dlgt);
1329
+int vfsub_sio_rmdir(struct inode *dir, struct dentry *dentry,
1330
+ struct vfsmount *mnt, int dlgt);
1332
/* ---------------------------------------------------------------------- */
1334
-int vfsub_notify_change(struct dentry *dentry, struct iattr *ia,
1335
- struct vfsub_args *vargs);
1336
-int vfsub_unlink(struct inode *dir, struct dentry *dentry,
1337
+int vfsub_notify_change(struct dentry *dentry, struct vfsmount *mnt,
1338
+ struct iattr *ia, struct vfsub_args *vargs);
1339
+int vfsub_unlink(struct inode *dir, struct dentry *dentry, struct vfsmount *mnt,
1340
struct vfsub_args *vargs);
1341
int vfsub_statfs(void *arg, struct kstatfs *buf, int dlgt);
1343
diff -urNad aufs-0+20071211~/fs/aufs/wbr_policy.c aufs-0+20071211/fs/aufs/wbr_policy.c
1344
--- aufs-0+20071211~/fs/aufs/wbr_policy.c 2007-11-26 02:34:50.000000000 +0100
1345
+++ aufs-0+20071211/fs/aufs/wbr_policy.c 2007-12-11 19:18:51.000000000 +0100
1347
#include <linux/statfs.h>
1350
-static int au_cpdown_attr(struct dentry *h_dst, struct dentry *h_src, int dlgt)
1351
+static int au_cpdown_attr(struct dentry *h_dst, struct dentry *h_src,
1352
+ struct vfsmount *h_dst_mnt, int dlgt)
1357
sbits = !!(ia.ia_mode & (S_ISUID | S_ISGID));
1359
vfsub_args_init(&vargs, NULL, dlgt, /*force_unlink*/0);
1360
- err = vfsub_notify_change(h_dst, &ia, &vargs);
1361
+ err = vfsub_notify_change(h_dst, h_dst_mnt, &ia, &vargs);
1363
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
1364
/* is this nfs only? */
1365
if (!err && sbits && au_test_nfs(h_dst->d_sb)) {
1366
ia.ia_valid = ATTR_FORCE | ATTR_MODE;
1367
ia.ia_mode = h_isrc->i_mode;
1368
- err = vfsub_notify_change(h_dst, &ia, &vargs);
1369
+ err = vfsub_notify_change(h_dst, h_dst_mnt, &ia, &vargs);
1374
aufs_bindex_t bend, bopq;
1375
struct dentry *h_dentry, *opq_dentry, *wh_dentry;
1376
struct inode *h_dir, *h_inode, *inode;
1377
+ struct vfsmount *h_mnt;
1379
LKTRTrace("%.*s, b%d\n", AuDLNPair(dentry), bdst);
1380
AuDebugOn(dbstart(dentry) <= bdst
1382
err = au_lkup_neg(dentry, bdst);
1383
if (unlikely(err < 0))
1385
+ h_mnt = sbr_mnt(dentry->d_sb, bdst);
1386
h_dentry = au_h_dptr_i(dentry, bdst);
1387
dlgt = au_need_dlgt(dentry->d_sb);
1388
- err = vfsub_sio_mkdir(h_dir, h_dentry, 0755, dlgt);
1389
+ err = vfsub_sio_mkdir(h_dir, h_dentry, h_mnt, 0755, dlgt);
1397
- err = au_cpdown_attr(h_dentry, au_h_dptr(dentry), dlgt);
1398
+ err = au_cpdown_attr(h_dentry, au_h_dptr(dentry), h_mnt, dlgt);
1399
vfsub_i_unlock(h_inode);
1405
if (wh_dentry->d_inode)
1406
- err = au_unlink_wh_dentry(h_dir, wh_dentry, dentry,
1408
+ err = au_unlink_wh_dentry(h_dir, wh_dentry, h_mnt,
1409
+ dentry, NULL, dlgt);
1417
- rerr = vfsub_sio_rmdir(h_dir, h_dentry, dlgt);
1418
+ rerr = vfsub_sio_rmdir(h_dir, h_dentry, h_mnt, dlgt);
1419
if (unlikely(rerr)) {
1420
AuIOErr("failed removing %.*s b%d (%d)\n",
1421
AuDLNPair(dentry), bdst, rerr);
1422
diff -urNad aufs-0+20071211~/fs/aufs/whout.c aufs-0+20071211/fs/aufs/whout.c
1423
--- aufs-0+20071211~/fs/aufs/whout.c 2007-11-12 02:43:10.000000000 +0100
1424
+++ aufs-0+20071211/fs/aufs/whout.c 2007-12-11 19:18:51.000000000 +0100
1426
struct dentry *h_dentry, *h_parent, *tmp_dentry;
1427
struct super_block *sb;
1428
struct aufs_hin_ignore ign;
1429
+ struct vfsmount *h_mnt;
1430
struct vfsub_args vargs;
1431
struct aufs_ndx ndx = {
1433
@@ -240,13 +241,15 @@
1434
err = PTR_ERR(tmp_dentry);
1435
if (!IS_ERR(tmp_dentry)) {
1436
/* under the same dir, no need to lock_rename() */
1437
+ h_mnt = sbr_mnt(sb, bindex);
1438
vfsub_args_init(&vargs, &ign, ndx.dlgt, 0);
1439
AuDebugOn(!S_ISDIR(dentry->d_inode->i_mode));
1440
if (unlikely(au_flag_test_udba_inotify(sb)
1442
vfsub_ign_hinode(&vargs, IN_MOVE_SELF,
1443
itohi(dentry->d_inode, bindex));
1444
- err = vfsub_rename(h_dir, h_dentry, h_dir, tmp_dentry, &vargs);
1445
+ err = vfsub_rename(h_dir, h_dentry, h_mnt, h_dir, tmp_dentry,
1447
//if (LktrCond) err = -1; //unavailable
1451
/* ---------------------------------------------------------------------- */
1453
static int do_unlink_wh(struct inode *h_dir, struct dentry *wh_dentry,
1454
- struct inode *dir, int dlgt)
1455
+ struct vfsmount *h_mnt, struct inode *dir, int dlgt)
1457
struct vfsub_args vargs;
1459
@@ -274,11 +277,12 @@
1460
vfsub_args_init(&vargs, NULL, dlgt,
1461
(h_dir->i_mode & S_ISVTX)
1462
&& wh_dentry->d_inode->i_uid != current->fsuid);
1463
- return vfsub_unlink(h_dir, wh_dentry, &vargs);
1464
+ return vfsub_unlink(h_dir, wh_dentry, h_mnt, &vargs);
1467
int au_unlink_wh_dentry(struct inode *h_dir, struct dentry *wh_dentry,
1468
- struct dentry *dentry, struct inode *dir, int dlgt)
1469
+ struct vfsmount *h_mnt, struct dentry *dentry,
1470
+ struct inode *dir, int dlgt)
1475
|| !wh_dentry->d_inode
1476
|| !S_ISREG(wh_dentry->d_inode->i_mode));
1478
- err = do_unlink_wh(h_dir, wh_dentry, dir, dlgt);
1479
+ err = do_unlink_wh(h_dir, wh_dentry, h_mnt, dir, dlgt);
1480
//if (LktrCond) err = -1; // unavailable
1482
set_dbwh(dentry, -1);
1486
static int unlink_wh_name(struct dentry *h_parent, struct qstr *wh,
1487
- struct inode *dir, struct aufs_ndx *ndx)
1488
+ struct vfsmount *h_mnt, struct inode *dir,
1489
+ struct aufs_ndx *ndx)
1492
struct inode *h_dir;
1495
if (h_dentry->d_inode
1496
&& S_ISREG(h_dentry->d_inode->i_mode))
1497
- err = do_unlink_wh(h_dir, h_dentry, dir, ndx->dlgt);
1498
+ err = do_unlink_wh(h_dir, h_dentry, h_mnt, dir,
1502
err = PTR_ERR(h_dentry);
1505
/* ---------------------------------------------------------------------- */
1507
-static void clean_wh(struct inode *h_dir, struct dentry *wh)
1508
+static void clean_wh(struct inode *h_dir, struct dentry *wh,
1509
+ struct vfsmount *h_mnt)
1512
struct vfsub_args vargs;
1513
@@ -334,14 +341,15 @@
1516
vfsub_args_init(&vargs, NULL, 0, 0);
1517
- err = vfsub_unlink(h_dir, wh, &vargs);
1518
+ err = vfsub_unlink(h_dir, wh, h_mnt, &vargs);
1520
AuWarn("failed unlink %.*s (%d), ignored.\n",
1521
AuDLNPair(wh), err);
1525
-static void clean_plink(struct inode *h_dir, struct dentry *plink)
1526
+static void clean_plink(struct inode *h_dir, struct dentry *plink,
1527
+ struct vfsmount *h_mnt)
1530
struct vfsub_args vargs;
1533
if (plink->d_inode) {
1534
vfsub_args_init(&vargs, NULL, 0, 0);
1535
- err = vfsub_rmdir(h_dir, plink, &vargs);
1536
+ err = vfsub_rmdir(h_dir, plink, h_mnt, &vargs);
1538
AuWarn("failed rmdir %.*s (%d), ignored.\n",
1539
AuDLNPair(plink), err);
1544
-static int plink_dir(struct inode *h_dir, struct dentry *plink)
1545
+static int plink_dir(struct inode *h_dir, struct dentry *plink,
1546
+ struct vfsmount *h_mnt)
1552
if (unlikely(au_test_nfs(plink->d_sb)))
1554
- err = vfsub_mkdir(h_dir, plink, mode, /*dlgt*/0);
1555
+ err = vfsub_mkdir(h_dir, plink, h_mnt, mode, /*dlgt*/0);
1556
} else if (S_ISDIR(plink->d_inode->i_mode))
1559
@@ -439,23 +448,23 @@
1563
- clean_wh(h_dir, wh);
1564
- clean_plink(h_dir, plink);
1565
+ clean_wh(h_dir, wh, br->br_mnt);
1566
+ clean_plink(h_dir, plink, br->br_mnt);
1569
case AuBr_RWNoLinkWH:
1570
- clean_wh(h_dir, wh);
1571
+ clean_wh(h_dir, wh, br->br_mnt);
1573
err = test_linkable(h_dir);
1577
- err = plink_dir(h_dir, plink);
1578
+ err = plink_dir(h_dir, plink, br->br_mnt);
1581
br->br_plink = dget(plink);
1583
- clean_plink(h_dir, plink);
1584
+ clean_plink(h_dir, plink, br->br_mnt);
1588
@@ -484,12 +493,12 @@
1592
- err = plink_dir(h_dir, plink);
1593
+ err = plink_dir(h_dir, plink, br->br_mnt);
1596
br->br_plink = dget(plink);
1598
- clean_plink(h_dir, plink);
1599
+ clean_plink(h_dir, plink, br->br_mnt);
1600
br->br_wh = dget(wh);
1604
vfsub_args_init(&vargs, NULL, /*dlgt*/0, 0);
1605
hdir_lock(h_dir, dir, bindex);
1606
br_wh_write_lock(a->br);
1607
- err = vfsub_unlink(h_dir, a->br->br_wh, &vargs);
1608
+ err = vfsub_unlink(h_dir, a->br->br_wh, a->br->br_mnt, &vargs);
1609
//if (LktrCond) err = -1;
1611
a->br->br_wh = NULL;
1613
br = stobr(sb, bindex);
1614
br_wh_read_lock(br);
1616
- err = vfsub_link(br->br_wh, h_dir, wh, dlgt);
1617
+ err = vfsub_link(br->br_wh, br->br_mnt, h_dir, wh, br->br_mnt,
1619
if (!err || err != -EMLINK)
1624
AuDebugOn(/* !S_ISDIR(dentry->d_inode->i_mode)
1625
* || */!opq_dentry->d_inode);
1626
- err = do_unlink_wh(h_dir, opq_dentry, dentry->d_inode,
1628
+ err = do_unlink_wh(h_dir, opq_dentry, sbr_mnt(sb, bindex),
1629
+ dentry->d_inode, ndx.dlgt);
1630
//if (LktrCond) err = -1;
1632
set_dbdiropq(dentry, -1);
1634
struct aufs_wh *tpos;
1635
struct hlist_node *pos;
1636
struct aufs_destr *str;
1637
+ struct vfsmount *h_mnt;
1639
LKTRTrace("%.*s\n", AuDLNPair(h_parent));
1640
h_dir = h_parent->d_inode;
1643
/* already checked by au_test_perm(). */
1645
+ h_mnt = sbr_mnt(inode->i_sb, bindex);
1646
for (i = 0; !err && i < AuSize_NHASH; i++) {
1647
head = whlist->heads + i;
1648
hlist_for_each_entry(tpos, pos, head, wh_hash) {
1650
if (str->len + AUFS_WH_PFX_LEN <= PATH_MAX) {
1651
memcpy(p, str->name, str->len);
1652
wh_name.len = AUFS_WH_PFX_LEN + str->len;
1653
- err = unlink_wh_name(h_parent, &wh_name, inode,
1655
+ err = unlink_wh_name(h_parent, &wh_name, h_mnt,
1657
//if (LktrCond) err = -1;
1662
vfsub_ign_hinode(&vargs, IN_DELETE_SELF,
1663
itohi(inode, bindex));
1664
- err = vfsub_rmdir(h_dir, h_dentry, &vargs);
1665
+ err = vfsub_rmdir(h_dir, h_dentry, sbr_mnt(sb, bindex), &vargs);
1667
//if (LktrCond) err = -1;
1669
diff -urNad aufs-0+20071211~/fs/aufs/whout.h aufs-0+20071211/fs/aufs/whout.h
1670
--- aufs-0+20071211~/fs/aufs/whout.h 2007-10-01 06:48:51.000000000 +0200
1671
+++ aufs-0+20071211/fs/aufs/whout.h 2007-12-11 19:18:51.000000000 +0100
1673
int rename_whtmp(struct inode *dir, struct dentry *dentry, aufs_bindex_t bindex,
1675
int au_unlink_wh_dentry(struct inode *h_dir, struct dentry *wh_dentry,
1676
- struct dentry *dentry, struct inode *dir, int dlgt);
1677
+ struct vfsmount *h_mnt, struct dentry *dentry,
1678
+ struct inode *dir, int dlgt);
1681
int init_wh(struct dentry *h_parent, struct aufs_branch *br,
1682
diff -urNad aufs-0+20071211~/fs/aufs/xino.c aufs-0+20071211/fs/aufs/xino.c
1683
--- aufs-0+20071211~/fs/aufs/xino.c 2007-12-10 02:19:54.000000000 +0100
1684
+++ aufs-0+20071211/fs/aufs/xino.c 2007-12-11 19:18:52.000000000 +0100
1686
h_dir = h_parent->d_inode;
1687
vfsub_args_init(&vargs, NULL, 0, 0);
1688
vfsub_i_lock_nested(h_dir, AuLsc_I_PARENT);
1689
- err = vfsub_unlink(h_dir, file->f_dentry, &vargs);
1690
+ err = vfsub_unlink(h_dir, file->f_dentry, file->f_vfsmnt, &vargs);
1691
vfsub_i_unlock(h_dir);
1693
if (unlikely(err)) {
1697
vfsub_args_init(&vargs, NULL, 0, 0);
1698
- err = vfsub_unlink(dir, dentry, &vargs);
1699
+ err = vfsub_unlink(dir, dentry, file->f_vfsmnt, &vargs);
1700
//if (LktrCond) err = -1;
1701
if (unlikely(err)) {
1702
AuErr("%.*s unlink err %d\n", AuLNPair(name), err);
1705
if (unlikely(copy_src)) {
1706
inode = copy_src->f_dentry->d_inode;
1707
- err = au_copy_file(file, copy_src, i_size_read(inode), sb);
1708
+ err = au_copy_file(file, copy_src, i_size_read(inode), sb,
1710
if (unlikely(err)) {
1711
AuErr("%.*s copy err %d\n", AuLNPair(name), err);