From 95b044cff32b6fda5c4a9d4e3c1b58e225d989fd Mon Sep 17 00:00:00 2001 From: Yura Pakhuchiy Date: Mon, 3 Sep 2007 19:51:01 +0300 Subject: [PATCH] Small enchantments and cleanups from ntfs-3g --- libntfs/attrib.c | 12 ++++++++++-- ntfsprogs/ntfsmount.c | 4 ++-- ntfsprogs/utils.c | 7 +++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 2f088cb9..2fc0f6d1 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1395,8 +1395,16 @@ done: if (ctx) ntfs_attr_put_search_ctx(ctx); /* Update mapping pairs if needed. */ - if (need_to.update_mapping_pairs) - ntfs_attr_update_mapping_pairs(na, update_from); + if (need_to.update_mapping_pairs) { + if (ntfs_attr_update_mapping_pairs(na, update_from)) { + /* FIXME: We want rollback here. */ + ntfs_log_perror("%s(): Failed to update mapping pairs. " + "Leaving inconsistent metadata. " + "Run chkdsk!", __FUNCTION__); + errno = EIO; + return -1; + } + } /* Finally, return the number of bytes written. */ return total; rl_err_out: diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 38931692..198c8aab 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -165,7 +165,7 @@ static const struct fuse_opt ntfs_fuse_opts[] = { static const char *EXEC_NAME = "ntfsmount"; static char ntfs_fuse_default_options[] = - "default_permissions,allow_other,use_ino,kernel_cache"; + "default_permissions,allow_other,use_ino,kernel_cache,nonempty"; static ntfs_fuse_context_t *ctx; /** @@ -711,7 +711,7 @@ static int ntfs_fuse_write(const char *org_path, const char *buf, size_t size, } while (size) { res = ntfs_attr_pwrite(na, offset, size, buf); - if (res < (s64)size) + if (res < (s64)size && errno != ENOSPC) ntfs_log_error("ntfs_attr_pwrite returned less bytes " "than requested.\n"); if (res <= 0) { diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 9d8beb9e..ddc79c5e 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -122,6 +122,11 @@ static const char *dirty_volume_msg = "(NOT to us!) that init scripts kill ntfsmount or mount.ntfs-fuse during\n" "shutdown instead of proper umount.\n"; +static const char *fakeraid_msg = +"You seem to have a SoftRAID/FakeRAID hardware and must use an activated,\n" +"different device under /dev/mapper, (e.g. /dev/mapper/nvidia_eahaabcc1)\n" +"to mount NTFS. Please see the 'dmraid' documentation for help.\n"; + /** * utils_set_locale */ @@ -227,6 +232,8 @@ ntfs_volume * utils_mount_volume(const char *device, unsigned long flags, ntfs_log_error("%s", unclean_journal_msg); else if (errno == EBUSY) ntfs_log_error("%s", opened_volume_msg); + else if (errno == ENXIO) + ntfs_log_error("%s", fakeraid_msg); return NULL; }