]) # LC_HAVE_BIO_END_SECTOR
#
+# 3.9 created is_sxid
+#
+AC_DEFUN([LC_HAVE_IS_SXID], [
+LB_CHECK_COMPILE([if 'is_sxid' is defined],
+is_sxid, [
+ #include <linux/fs.h>
+],[
+ struct inode inode;
+
+ is_sxid(inode.i_mode);
+],[
+ AC_DEFINE(HAVE_IS_SXID, 1, [is_sxid is defined])
+])
+]) # LC_HAVE_IS_SXID
+
+#
# LC_HAVE_REMOVE_PROC_SUBTREE
#
# 3.10 introduced remove_proc_subtree
# 3.9
LC_HAVE_HLIST_FOR_EACH_3ARG
LC_HAVE_BIO_END_SECTOR
+ LC_HAVE_IS_SXID
# 3.10
LC_BLKDEV_RELEASE_RETURN_INT
}
#endif
+#ifndef HAVE_IS_SXID
+static inline bool is_sxid(umode_t mode)
+{
+ return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP));
+}
+#endif
+
+#ifndef IS_NOSEC
+#define IS_NOSEC(inode) (!is_sxid(inode->i_mode))
+#endif
+
#ifndef HAVE_FILE_OPERATIONS_READ_WRITE_ITER
static inline void iov_iter_reexpand(struct iov_iter *i, size_t count)
{
}
static inline ssize_t
-generic_file_write_iter(struct kiocb *iocb, struct iov_iter *iter)
+__generic_file_write_iter(struct kiocb *iocb, struct iov_iter *iter)
{
struct iovec iov;
struct iov_iter i;
* consistency, proper locking to protect against writes,
* trucates, etc. is handled in the higher layers of lustre.
*/
- result = generic_file_write_iter(vio->vui_iocb, vio->vui_iter);
+ bool lock_node = !IS_NOSEC(inode);
+
+ if (lock_node)
+ inode_lock(inode);
+ result = __generic_file_write_iter(vio->vui_iocb,
+ vio->vui_iter);
+ if (lock_node)
+ inode_unlock(inode);
+
if (result > 0 || result == -EIOCBQUEUED) {
ssize_t err;