Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/kern/vfs_mount.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/kern/vfs_mount.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.12 retrieving revision 1.12.6.2 diff -u -p -r1.12 -r1.12.6.2 --- src/sys/kern/vfs_mount.c 2011/11/18 21:17:45 1.12 +++ src/sys/kern/vfs_mount.c 2014/12/04 05:38:54 1.12.6.2 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_mount.c,v 1.12 2011/11/18 21:17:45 christos Exp $ */ +/* $NetBSD: vfs_mount.c,v 1.12.6.2 2014/12/04 05:38:54 snj Exp $ */ /*- * Copyright (c) 1997-2011 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.12 2011/11/18 21:17:45 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.12.6.2 2014/12/04 05:38:54 snj Exp $"); #include #include @@ -83,6 +83,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_mount.c, #include #include #include +#include #include #include #include @@ -636,6 +637,22 @@ mount_checkdirs(vnode_t *olddp) vput(newdp); } +/* + * Start extended attributes + */ +static int +start_extattr(struct mount *mp) +{ + int error; + + error = VFS_EXTATTRCTL(mp, EXTATTR_CMD_START, NULL, 0, NULL); + if (error) + printf("%s: failed to start extattr: error = %d\n", + mp->mnt_stat.f_mntonname, error); + + return error; +} + int mount_domount(struct lwp *l, vnode_t **vpp, struct vfsops *vfsops, const char *path, int flags, void *data, size_t *data_len) @@ -758,8 +775,11 @@ mount_domount(struct lwp *l, vnode_t **v vfs_unbusy(mp, true, NULL); (void) VFS_STATVFS(mp, &mp->mnt_stat); error = VFS_START(mp, 0); - if (error) + if (error) { vrele(vp); + } else if (flags & MNT_EXTATTR) { + (void)start_extattr(mp); + } /* Drop reference held for VFS_START(). */ vfs_destroy(mp); *vpp = NULL; @@ -794,7 +814,7 @@ int dounmount(struct mount *mp, int flags, struct lwp *l) { vnode_t *coveredvp; - int error, async, used_syncer; + int error, async, used_syncer, used_extattr; #if NVERIEXEC > 0 error = veriexec_unmountchk(mp); @@ -815,6 +835,7 @@ dounmount(struct mount *mp, int flags, s } used_syncer = (mp->mnt_syncer != NULL); + used_extattr = mp->mnt_flag & MNT_EXTATTR; /* * XXX Syncer must be frozen when we get here. This should really @@ -853,6 +874,12 @@ dounmount(struct mount *mp, int flags, s rw_exit(&mp->mnt_unmounting); if (used_syncer) mutex_exit(&syncer_mutex); + if (used_extattr) { + if (start_extattr(mp) != 0) + mp->mnt_flag &= ~MNT_EXTATTR; + else + mp->mnt_flag |= MNT_EXTATTR; + } return (error); } vfs_scrubvnlist(mp);