Re: svn commit: r272952 - in head/sys: fs/ext2fs fs/msdosfs ufs/ffs

2014-10-12 Thread Bruce Evans

On Sat, 11 Oct 2014, Konstantin Belousov wrote:


Log:
 Do not set IN_ACCESS flag for read-only mounts.  The IN_ACCESS
 survives remount in rw, also it is set for vnodes on rootfs before
 noatime can be set or clock is adjusted.  All conditions result in
 wrong atime for accessed vnodes.

 Submitted by:  bde
 MFC after: 1 week


Thanks.


...
Modified: head/sys/ufs/ffs/ffs_vnops.c
==
--- head/sys/ufs/ffs/ffs_vnops.cSat Oct 11 18:58:58 2014
(r272951)
+++ head/sys/ufs/ffs/ffs_vnops.cSat Oct 11 19:09:56 2014
(r272952)
@@ -627,7 +627,7 @@ ffs_read(ap)
}

if ((error == 0 || uio-uio_resid != orig_resid) 
-   (vp-v_mount-mnt_flag  MNT_NOATIME) == 0 
+   (vp-v_mount-mnt_flag  (MNT_NOATIME | MNT_RDONLY)) == 0 
(ip-i_flag  IN_ACCESS) == 0) {
VI_LOCK(vp);
ip-i_flag |= IN_ACCESS;



Is it correct for only ffs to acquire the vnode interlock?  I think it
is, but don't remember which ffs-only feature requires it.

Bruce
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r272952 - in head/sys: fs/ext2fs fs/msdosfs ufs/ffs

2014-10-12 Thread Konstantin Belousov
On Mon, Oct 13, 2014 at 12:39:54AM +1100, Bruce Evans wrote:
  @@ -627,7 +627,7 @@ ffs_read(ap)
  }
 
  if ((error == 0 || uio-uio_resid != orig_resid) 
  -   (vp-v_mount-mnt_flag  MNT_NOATIME) == 0 
  +   (vp-v_mount-mnt_flag  (MNT_NOATIME | MNT_RDONLY)) == 0 
  (ip-i_flag  IN_ACCESS) == 0) {
  VI_LOCK(vp);
  ip-i_flag |= IN_ACCESS;
 
 
 Is it correct for only ffs to acquire the vnode interlock?  I think it
 is, but don't remember which ffs-only feature requires it.

We either hold the vnode lock exclusive, or shared + own the vnode interlock,
for i_flag modifications.  Since this is ffs_read(), which is entered with
the vnode shared locked, the interlock must be acquired.

Both msdosfs and ext2fs do not enable the shared locking mode for
the lockmgr locks serving as the vnodes locks, so msdosfs_read() and
ext2_read() are executed with vnode locked exclusively.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r272952 - in head/sys: fs/ext2fs fs/msdosfs ufs/ffs

2014-10-11 Thread Konstantin Belousov
Author: kib
Date: Sat Oct 11 19:09:56 2014
New Revision: 272952
URL: https://svnweb.freebsd.org/changeset/base/272952

Log:
  Do not set IN_ACCESS flag for read-only mounts.  The IN_ACCESS
  survives remount in rw, also it is set for vnodes on rootfs before
  noatime can be set or clock is adjusted.  All conditions result in
  wrong atime for accessed vnodes.
  
  Submitted by: bde
  MFC after:1 week

Modified:
  head/sys/fs/ext2fs/ext2_vnops.c
  head/sys/fs/msdosfs/msdosfs_vnops.c
  head/sys/ufs/ffs/ffs_vnops.c

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==
--- head/sys/fs/ext2fs/ext2_vnops.c Sat Oct 11 18:58:58 2014
(r272951)
+++ head/sys/fs/ext2fs/ext2_vnops.c Sat Oct 11 19:09:56 2014
(r272952)
@@ -1762,7 +1762,7 @@ ext2_ind_read(struct vop_read_args *ap)
}
 
if ((error == 0 || uio-uio_resid != orig_resid) 
-   (vp-v_mount-mnt_flag  MNT_NOATIME) == 0)
+   (vp-v_mount-mnt_flag  (MNT_NOATIME | MNT_RDONLY)) == 0)
ip-i_flag |= IN_ACCESS;
return (error);
 }

Modified: head/sys/fs/msdosfs/msdosfs_vnops.c
==
--- head/sys/fs/msdosfs/msdosfs_vnops.c Sat Oct 11 18:58:58 2014
(r272951)
+++ head/sys/fs/msdosfs/msdosfs_vnops.c Sat Oct 11 19:09:56 2014
(r272952)
@@ -642,7 +642,7 @@ msdosfs_read(ap)
brelse(bp);
} while (error == 0  uio-uio_resid  0  n != 0);
if (!isadir  (error == 0 || uio-uio_resid != orig_resid) 
-   (vp-v_mount-mnt_flag  MNT_NOATIME) == 0)
+   (vp-v_mount-mnt_flag  (MNT_NOATIME | MNT_RDONLY)) == 0)
dep-de_flag |= DE_ACCESS;
return (error);
 }

Modified: head/sys/ufs/ffs/ffs_vnops.c
==
--- head/sys/ufs/ffs/ffs_vnops.cSat Oct 11 18:58:58 2014
(r272951)
+++ head/sys/ufs/ffs/ffs_vnops.cSat Oct 11 19:09:56 2014
(r272952)
@@ -627,7 +627,7 @@ ffs_read(ap)
}
 
if ((error == 0 || uio-uio_resid != orig_resid) 
-   (vp-v_mount-mnt_flag  MNT_NOATIME) == 0 
+   (vp-v_mount-mnt_flag  (MNT_NOATIME | MNT_RDONLY)) == 0 
(ip-i_flag  IN_ACCESS) == 0) {
VI_LOCK(vp);
ip-i_flag |= IN_ACCESS;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org