Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/fs/smbfs pullup FreeBSD change rev. 1.44 - restore closi...



details:   https://anonhg.NetBSD.org/src/rev/542061a24ef3
branches:  trunk
changeset: 559586:542061a24ef3
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sat Mar 20 18:41:02 2004 +0000

description:
pullup FreeBSD change rev. 1.44 - restore closing of SMB find handle
in smbfs_close(); it's necessary to overcome limitation of the current
directory lookup code

this fixes problem where ls wouldn't show newly created files, such as:
> touch a b c
> ls
>

problem and fix pointed out by YAMAMOTO Takashi

diffstat:

 sys/fs/smbfs/smbfs_vnops.c |  28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diffs (51 lines):

diff -r 7aa6c3478fce -r 542061a24ef3 sys/fs/smbfs/smbfs_vnops.c
--- a/sys/fs/smbfs/smbfs_vnops.c        Sat Mar 20 18:34:57 2004 +0000
+++ b/sys/fs/smbfs/smbfs_vnops.c        Sat Mar 20 18:41:02 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smbfs_vnops.c,v 1.35 2004/02/29 12:19:15 jdolecek Exp $        */
+/*     $NetBSD: smbfs_vnops.c,v 1.36 2004/03/20 18:41:02 jdolecek Exp $        */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smbfs_vnops.c,v 1.35 2004/02/29 12:19:15 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smbfs_vnops.c,v 1.36 2004/03/20 18:41:02 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -297,9 +297,31 @@
                struct ucred *a_cred;
                struct proc *a_p;
        } */ *ap = v;
+       int error;
+       struct vnode *vp = ap->a_vp;
+       struct smbnode *np = VTOSMB(vp);
 
        /* Flush all file data */
-       return smbfs_vinvalbuf(ap->a_vp, V_SAVE, ap->a_cred, ap->a_p, 1);
+       error = smbfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1);
+       if (error)
+               return (error);
+
+       /*
+        * We must close the directory lookup context now, so that
+        * later directory changes would be properly detected.
+        * Ideally, the lookup routines should handle such case, and
+        * the context would be removed only in smbfs_inactive().
+        */
+       if (vp->v_type == VDIR && (np->n_flag & NOPEN) != 0 &&
+           np->n_dirseq != NULL) {
+               struct smb_cred scred;
+
+               smb_makescred(&scred, ap->a_p, ap->a_cred);
+               smbfs_findclose(np->n_dirseq, &scred);
+               np->n_dirseq = NULL;
+       }
+
+       return (0);
 }
 
 /*



Home | Main Index | Thread Index | Old Index