Whamcloud - gitweb
LU-354 test: Change dev_set_rdonly() check to warning
[fs/lustre-release.git] / lustre / lvfs / lvfs_linux.c
index fbd038d..63d2992 100644 (file)
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2011, 2012, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -129,7 +131,7 @@ void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx,
         LASSERT(cfs_atomic_read(&new_ctx->pwd->d_count));
         save->pwd = dget(cfs_fs_pwd(current->fs));
         save->pwdmnt = mntget(cfs_fs_mnt(current->fs));
-        save->luc.luc_umask = current->fs->umask;
+        save->luc.luc_umask = cfs_curproc_umask();
         save->ngroups = current_cred()->group_info->ngroups;
 
         LASSERT(save->pwd);
@@ -375,7 +377,7 @@ int lustre_fsync(struct file *file)
         if (!file || !file->f_op || !file->f_op->fsync)
                 RETURN(-ENOSYS);
 
-        RETURN(file->f_op->fsync(file, file->f_dentry, 0));
+        RETURN(cfs_do_fsync(file, 0));
 }
 EXPORT_SYMBOL(lustre_fsync);
 
@@ -388,13 +390,8 @@ struct l_file *l_dentry_open(struct lvfs_run_ctxt *ctxt, struct l_dentry *de,
 }
 EXPORT_SYMBOL(l_dentry_open);
 
-#ifdef HAVE_VFS_READDIR_U64_INO
 static int l_filldir(void *__buf, const char *name, int namlen, loff_t offset,
                      u64 ino, unsigned int d_type)
-#else
-static int l_filldir(void *__buf, const char *name, int namlen, loff_t offset,
-                     ino_t ino, unsigned int d_type)
-#endif
 {
         struct l_linux_dirent *dirent;
         struct l_readdir_callback *buf = (struct l_readdir_callback *)__buf;
@@ -492,14 +489,9 @@ out:
 EXPORT_SYMBOL(simple_truncate);
 
 #ifdef LUSTRE_KERNEL_VERSION
-#ifndef HAVE_CLEAR_RDONLY_ON_PUT
-#error rdonly patchset must be updated [cfs bz11248]
-#endif
-void dev_set_rdonly(lvfs_sbdev_type dev);
-int dev_check_rdonly(lvfs_sbdev_type dev);
-
-void __lvfs_set_rdonly(lvfs_sbdev_type dev, lvfs_sbdev_type jdev)
+int __lvfs_set_rdonly(lvfs_sbdev_type dev, lvfs_sbdev_type jdev)
 {
+#ifdef HAVE_DEV_SET_RDONLY
         if (jdev && (jdev != dev)) {
                 CDEBUG(D_IOCTL | D_HA, "set journal dev %lx rdonly\n",
                        (long)jdev);
@@ -507,14 +499,24 @@ void __lvfs_set_rdonly(lvfs_sbdev_type dev, lvfs_sbdev_type jdev)
         }
         CDEBUG(D_IOCTL | D_HA, "set dev %lx rdonly\n", (long)dev);
         dev_set_rdonly(dev);
+
+        return 0;
+#else
+        CERROR("DEV %lx CANNOT BE SET READONLY\n", (long)dev);
+
+        return -EOPNOTSUPP;
+#endif
 }
+EXPORT_SYMBOL(__lvfs_set_rdonly);
 
 int lvfs_check_rdonly(lvfs_sbdev_type dev)
 {
+#ifdef HAVE_DEV_SET_RDONLY
         return dev_check_rdonly(dev);
+#else
+        return 0;
+#endif
 }
-
-EXPORT_SYMBOL(__lvfs_set_rdonly);
 EXPORT_SYMBOL(lvfs_check_rdonly);
 
 int lvfs_check_io_health(struct obd_device *obd, struct file *file)