Whamcloud - gitweb
LU-791 obdfilter: Don't clear OBD_MD_FLFLAGS mistakenly
[fs/lustre-release.git] / lustre / utils / mount_utils.c
index b36a1df..1b06999 100644 (file)
@@ -26,7 +26,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
@@ -131,12 +131,19 @@ int get_mountdata(char *dev, struct lustre_disk_data *mo_ldd)
         sprintf(filepnm, "%s/mountdata", tmpdir);
         filep = fopen(filepnm, "r");
         if (filep) {
+                size_t num_read;
                 vprint("Reading %s\n", MOUNT_DATA_FILE);
-                fread(mo_ldd, sizeof(*mo_ldd), 1, filep);
+                num_read = fread(mo_ldd, sizeof(*mo_ldd), 1, filep);
+                if (num_read < 1 && ferror(filep)) {
+                        fprintf(stderr, "%s: Unable to read from file (%s): %s\n",
+                                progname, filepnm, strerror(errno));
+                        goto out_close;
+                }
         } else {
                 verrprint("%s: Unable to read %d.%d config %s.\n",
                           progname, LUSTRE_MAJOR, LUSTRE_MINOR, filepnm);
-                goto out_close;
+                ret = 1;
+                goto out_rmdir;
         }
 
 out_close: