ntfs-3g mounted with both options relatime and noatime

Bug #210528 reported by aapgorilla
4
Affects Status Importance Assigned to Milestone
ntfs-3g (Ubuntu)
Confirmed
Undecided
Unassigned
Nominated for Hardy by Jonathan Rascher

Bug Description

Binary package hint: libntfs-3g23

The noatime option is always added when mounting ntfs-3g even when other mount options are given and even when the default shoud be relatime

$ sudo mount -t ntfs-3g /dev/sdb1 /media/sdb1/ -o relatime
/var/log/syslog
Apr 2 00:42:10 ubuntu-desktop ntfs-3g[10205]: Version 1.2216 external FUSE 27
Apr 2 00:42:10 ubuntu-desktop ntfs-3g[10205]: Mounted /dev/sdb1 (Read-Write, label "", NTFS 3.1)
Apr 2 00:42:10 ubuntu-desktop ntfs-3g[10205]: Cmdline options: rw,relatime
Apr 2 00:42:10 ubuntu-desktop ntfs-3g[10205]: Mount options: rw,silent,allow_other,nonempty,relatime,noatime,fsname=/dev/sdb1,blkdev,blksize=4096

$ sudo mount -t ntfs-3g /dev/sdb1 /media/sdb1/
/var/log/syslog
Apr 2 00:45:04 ubuntu-desktop ntfs-3g[10253]: Version 1.2216 external FUSE 27
Apr 2 00:45:04 ubuntu-desktop ntfs-3g[10253]: Mounted /dev/sdb1 (Read-Write, label "", NTFS 3.1)
Apr 2 00:45:04 ubuntu-desktop ntfs-3g[10253]: Cmdline options: rw
Apr 2 00:45:04 ubuntu-desktop ntfs-3g[10253]: Mount options: rw,silent,allow_other,nonempty,relatime,noatime,fsname=/dev/sdb1,blkdev,blksize=4096

from man ntfs-3g:

    atime, noatime, relatime
              The atime option updates inode access time for each access.

              The noatime option disables inode access time updates which can
              speed up file operations and prevent sleeping (notebook) disks
              spinning up too often thus saving energy and disk lifetime.

              The relatime option is very similar to noatime. It updates
              inode access times relative to modify or change time. The
              access time is only updated if the previous access time was ear\u2010
              lier than the current modify or change time. Unlike noatime this
              option doesn\u2019t break applications that need to know if a file
              has been read since the last time it was modified. This is the
              default behaviour.

Revision history for this message
Emil Sit (emilsit) wrote :

Confirmed; I reproduced this problem as follows on Hardy Beta:

$ touch ntfs-test.img
$ shred -n1 -s 16M ntfs-test.img
$ sudo losetup /dev/loop0 ntfs-test.img
$ sudo mkntfs -f -L test /dev/loop0
$ sudo mount -t ntfs-3g /dev/loop0 /mnt -o atime

Also, e.g.,
$ sudo mount -t ntfs-3g -o atime,debug /dev/loop0 /mnt
Version 1.2216 external FUSE 27
Mounted /dev/loop0 (Read-Write, label "test", NTFS 3.1)
Cmdline options: rw,debug
Mount options: rw,silent,allow_other,nonempty,relatime,noatime,fsname=/dev/loop0,blkdev,blksize=4096
$ mount | grep loop
/dev/loop0 on /mnt type fuseblk (rw,nosuid,nodev,noatime,allow_other,blksize=4096)

The following packages are installed:
$ dpkg -l | grep ntfs
ii libntfs-3g23 1:1.2216-1ubuntu1 ntfs-3g filesystem in userspace (FUSE) libra
ii libntfs10 2.0.0-1ubuntu2 library that provides common NTFS access fun
ii ntfs-3g 1:1.2216-1ubuntu1 read-write NTFS driver for FUSE
ii ntfsprogs 2.0.0-1ubuntu2 tools for doing neat things in NTFS partitio

Changed in ntfs-3g:
status: New → Confirmed
Revision history for this message
Emil Sit (emilsit) wrote :

The problem appears to be in the upstream ntfs-3g implementation (parse_mount_options in src/ntfs-3g.c, for both 1.2216 and 1.2310), which has:

        if (ctx->atime == ATIME_RELATIVE && strappend(&ret, "relatime,"))
                goto err_exit;
        else if (ctx->atime == ATIME_ENABLED && strappend(&ret, "atime,"))
                goto err_exit;
        else if (strappend(&ret, "noatime,"))
                goto err_exit;

Since strappend returns 0 on success, if atime == ATIME_RELATIVE or ATIME_ENABLED, the first two clauses will always return false, so the last case is always reached.

Don't have time to patch and submit upstream.

Revision history for this message
Szabolcs Szakacsits (szaka) wrote :

This is already fixed in the NTFS-3G CVS and will be included in this month of NTFS-3G release. Thanks.

Revision history for this message
Szabolcs Szakacsits (szaka) wrote :

Actually there are two problems here:

1. The extra added noatime option which is fixed in NTFS-3G CVS.

2. The atime->relatime change which is a problem in the mount(8) utility because it doesn't pass the atime option to NTFS-3G, so it defaults to relatime.

Revision history for this message
Emil Sit (emilsit) wrote :

Can we backport a patch to fix problem 1?
Is there a bug filed for problem 2?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.