Re: Possible to 'invalidate cache'?

2007-03-19 Thread sfjro

"Jrgen_P._Tjern":
> So either there were other conditions to cause my BUG @ super.c:357, or =
> 
> the newest CVS fixed the problem by itself.

There is a condition to reproduce this bug.

$ cd /your/aufs/subdir
$ sudo mount -o remount,udba=inotify /your/aufs
then you will meet BUG @ super.c:357 again.

It means the subdir is in use, and aufs tries some processing at
remount-time. If you didn't use any of subdir, you would not meet the
bug. I guess the samba service daemon refered a subdir when the first
time you met the bug.


Junjiro Okajima



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Re: Possible to 'invalidate cache'?

2007-03-19 Thread Jørgen P. Tjernø
[EMAIL PROTECTED] wrote:
>> BUG at /root/aufs.wcvs/aufs/fs/aufs/super.c:357!
>> must be a bug in aufs. I will fix it as soon as possible.
> 
> Please apply this patch, which is against the latest source in CVS.
> If you success, it will be included in next release.
> 
> This patch is only for BUG at super.c:357 only.

I applied the patch, and it seems to have worked great. But I also tried 
reproducing the bug with the old source, and it doesn't seem to work. 
That is, I can't get a new BUG at super.c:357. I mount /storage, do a 
mount -o remount,udba=inotify /storage, and it seems to work. (NOTE: 
this is this weeks monday release, *not* the version I was running when 
I first stumbled upon BUG at super.c:357)

So either there were other conditions to cause my BUG @ super.c:357, or 
the newest CVS fixed the problem by itself.

In any case, thanks a lot. :-)

Kindest regards, Jørgen Tjernø.

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Re: Possible to 'invalidate cache'?

2007-03-19 Thread sfjro

> BUG at /root/aufs.wcvs/aufs/fs/aufs/super.c:357!
> must be a bug in aufs. I will fix it as soon as possible.

Please apply this patch, which is against the latest source in CVS.
If you success, it will be included in next release.

This patch is only for BUG at super.c:357 only.


Junjiro Okajima

--
Index: fs/aufs/branch.c
===
RCS file: /cvsroot/aufs/aufs/fs/aufs/branch.c,v
retrieving revision 1.42
diff -u -p -r1.42 branch.c
--- fs/aufs/branch.c19 Mar 2007 04:29:53 -  1.42
+++ fs/aufs/branch.c19 Mar 2007 11:55:53 -
@@ -474,7 +474,7 @@ int br_add(struct super_block *sb, struc
maxb = add->nd.dentry->d_sb->s_maxbytes;
if (sb->s_maxbytes < maxb)
sb->s_maxbytes = maxb;
-   au_sigen_inc(sb);
+   //au_sigen_inc(sb);
 
if (IS_MS(sb, MS_XINO)) {
struct file *base_file = stobr(sb, 0)->br_xino;
@@ -657,7 +657,7 @@ int br_del(struct super_block *sb, struc
sbinfo->si_bend--;
dinfo->di_bend--;
iinfo->ii_bend--;
-   au_sigen_inc(sb);
+   //au_sigen_inc(sb);
if (!bindex)
au_cpup_attr_all(inode);
else
@@ -696,6 +696,21 @@ int br_del(struct super_block *sb, struc
return err;
 }
 
+static int do_need_sigen_inc(unsigned int a, unsigned int b)
+{
+   return (is_whable(a) && !is_whable(b));
+}
+
+static int need_sigen_inc(unsigned int old, unsigned int new)
+{
+   return (do_need_sigen_inc(old, new)
+   || do_need_sigen_inc(new, old));
+}
+
+/*
+ * returns tri-status.
+ * plus means the si_generation needs to be incremented later.
+ */
 int br_mod(struct super_block *sb, struct opt_mod *mod, int remount)
 {
int err;
@@ -783,10 +798,9 @@ int br_mod(struct super_block *sb, struc
goto out;
}
 
+   err = need_sigen_inc(br->br_perm, mod->perm);
br->br_perm = mod->perm;
-   // no need to inc?
-   //au_sigen_inc(sb);
-   return 0; /* success */
+   return err; /* success */
 
  out:
TraceErr(err);
Index: fs/aufs/branch.h
===
RCS file: /cvsroot/aufs/aufs/fs/aufs/branch.h,v
retrieving revision 1.25
diff -u -p -r1.25 branch.h
--- fs/aufs/branch.h19 Mar 2007 04:30:30 -  1.25
+++ fs/aufs/branch.h19 Mar 2007 11:55:53 -
@@ -64,6 +64,9 @@ struct aufs_branch {
 #define sbr_perm(sb, bindex)   ({stobr(sb, bindex)->br_perm;})
 #define sbr_perm_str(sb, bindex, str, len) \
br_perm_str(str, len, stobr(sb, bindex)->br_perm)
+#define is_whable(perm)(perm & (MAY_WRITE | AUFS_MAY_WH))
+#define sbr_is_whable(sb, bindex) \
+   is_whable(sbr_perm(sb, bindex))
 
 #define br_wh_read_lock(br)rw_read_lock(&(br)->br_wh_rwsem, AUFS_LSC_BR_WH)
 #define br_wh_read_unlock(br)  rw_read_unlock(&(br)->br_wh_rwsem)
Index: fs/aufs/dentry.c
===
RCS file: /cvsroot/aufs/aufs/fs/aufs/dentry.c,v
retrieving revision 1.34
diff -u -p -r1.34 dentry.c
--- fs/aufs/dentry.c19 Mar 2007 04:31:31 -  1.34
+++ fs/aufs/dentry.c19 Mar 2007 11:55:53 -
@@ -158,7 +158,7 @@ static struct dentry *do_lookup(struct d
 
wh_found = 0;
sb = dentry->d_sb;
-   wh_able = (sbr_perm(sb, bindex) & (MAY_WRITE | AUFS_MAY_WH));
+   wh_able = sbr_is_whable(sb, bindex);
lkup.nfsmnt = mnt_nfs(sb, bindex);
name = &dentry->d_name;
if (unlikely(wh_able)) {
@@ -474,8 +474,16 @@ int au_refresh_hdentry(struct dentry *de
}
}
 
-   dinfo->di_bwh = bwh;
-   dinfo->di_bdiropq = bdiropq;
+   dinfo->di_bwh = -1;
+   if (unlikely(bwh != -1
+&& bwh <= sbend(sb)
+&& sbr_is_whable(sb, bwh)))
+   dinfo->di_bwh = bwh;
+   dinfo->di_bdiropq = -1;
+   if (unlikely(bdiropq != -1
+&& bdiropq <= sbend(sb)
+&& sbr_is_whable(sb, bdiropq)))
+   dinfo->di_bdiropq = bdiropq;
parent_bend = dbend(parent);
p = dinfo->di_hdentry;
for (bindex = 0; bindex <= parent_bend; bindex++, p++)
Index: fs/aufs/opts.c
===
RCS file: /cvsroot/aufs/aufs/fs/aufs/opts.c,v
retrieving revision 1.28
diff -u -p -r1.28 opts.c
--- fs/aufs/opts.c  19 Mar 2007 04:32:35 -  1.28
+++ fs/aufs/opts.c  19 Mar 2007 11:55:53 -
@@ -715,7 +715,7 @@ int parse_opts(struct super_block *sb, c
 
 int do_opts(struct super_block *sb, struct opts *opts, int remount)
 {
-   int err;
+   int err, do_sigen;
struct opt *opt;
struct aufs_sbinfo *sbinfo;
struct inode *dir;
@@ -735,10 +735,12 @@ int do_opts(struct super_block *sb, stru
}
 
err = 0;
+   do_sigen 

Re: Possible to 'invalidate cache'?

2007-03-18 Thread sfjro

"Jrgen_P._Tjern":
> Any way I can manually invalidate whatever cache is used to perform the =
> 
> aufs -> branch lookup? Or should I use udba=3Dinotify?

Basically, you can discard cache by 'mount -o remount /your/aufs"
But the cahce in use will not be discarded.

--

> I tried a simple umount -o remount,udba=inotify /storage, and the 
> following popped up in my dmesg (see attached file).

What you did is,
- mount your aufs with /vault/disk1=rw and /vault/disk2=rw
- mkdir /vault/disk1/misc (to the branch directly)
- mount -o remount,udba=inotify /storage
Am I wright?

The direct branch access, mkdir in your case, before setting
udba=inotify cannot be detected by aufs. So the directory you made may
be still invisible by aufs.

BUG at /root/aufs.wcvs/aufs/fs/aufs/super.c:357!
must be a bug in aufs. I will fix it as soon as possible.
Until then, please use udba=inotify at mount-time, before you mkdir.


Junjiro Okajima

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Possible to 'invalidate cache'?

2007-03-18 Thread Jørgen P. Tjernø
I've got a problem I stumble upon with certain intervals; I've copied 
some files using samba to a directory that exists on a branch that's 
running out of space. So, I want to put files on another branch, and 
create the directory structure neccessary in another branch.
example: /storage is a merge of /vault/disk1 and /vault/disk2, both rw.
I want to put files under /storage/misc on disk2, but disk2 has the 
directory structure already (/vault/disk2/misc). So I create 
/vault/disk1/misc.

Now, the problem is, /storage does not notice this! When I now copy 
files to /storage/misc, it still puts them on disk2!

This is my example /proc/mounts (as you can see, disk1 has the highest 
priority, and should be used).
none /storage aufs 
rw,xino=/vault/disk1/.aufs.xino,br:/vault/disk1=rw:/vault/disk2=rw 0 0

Any way I can manually invalidate whatever cache is used to perform the 
aufs -> branch lookup? Or should I use udba=inotify?

Kindest regards, Jørgen.

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV