Fix for re-reading /etc/mtab in zfs_is_mounted()
authorJohn Layman <jlayman@sagecloud.com>
Tue, 13 Aug 2013 19:24:58 +0000 (15:24 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 14 Aug 2013 18:37:06 +0000 (11:37 -0700)
commitfb5c53ea65b75c67c23f90ebbbb1134a5bb6c140
tree065e9259c2d73bed859c8de8039ca2c2c221e184
parent105afebb1529c21c3fb1ef7101918ed9fb704942
Fix for re-reading /etc/mtab in zfs_is_mounted()

When /etc/mtab is updated on Linux it's done atomically with
rename(2).  A new mtab is written, the existing mtab is unlinked,
and the new mtab is renamed to /etc/mtab.  This means that we
must close the old file and open the new file to get the updated
contents.  Using rewind(3) will just move the file pointer back
to the start of the file, freopen(3) will close and open the file.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1611
lib/libzfs/libzfs_dataset.c