|
@@ -46,48 +46,6 @@
|
|
|
#include "xfs_rw.h"
|
|
|
#include "xfs_trace.h"
|
|
|
|
|
|
-/*
|
|
|
- * This is a subroutine for xfs_write() and other writers (xfs_ioctl)
|
|
|
- * which clears the setuid and setgid bits when a file is written.
|
|
|
- */
|
|
|
-int
|
|
|
-xfs_write_clear_setuid(
|
|
|
- xfs_inode_t *ip)
|
|
|
-{
|
|
|
- xfs_mount_t *mp;
|
|
|
- xfs_trans_t *tp;
|
|
|
- int error;
|
|
|
-
|
|
|
- mp = ip->i_mount;
|
|
|
- tp = xfs_trans_alloc(mp, XFS_TRANS_WRITEID);
|
|
|
- if ((error = xfs_trans_reserve(tp, 0,
|
|
|
- XFS_WRITEID_LOG_RES(mp),
|
|
|
- 0, 0, 0))) {
|
|
|
- xfs_trans_cancel(tp, 0);
|
|
|
- return error;
|
|
|
- }
|
|
|
- xfs_ilock(ip, XFS_ILOCK_EXCL);
|
|
|
- xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
|
|
|
- xfs_trans_ihold(tp, ip);
|
|
|
- ip->i_d.di_mode &= ~S_ISUID;
|
|
|
-
|
|
|
- /*
|
|
|
- * Note that we don't have to worry about mandatory
|
|
|
- * file locking being disabled here because we only
|
|
|
- * clear the S_ISGID bit if the Group execute bit is
|
|
|
- * on, but if it was on then mandatory locking wouldn't
|
|
|
- * have been enabled.
|
|
|
- */
|
|
|
- if (ip->i_d.di_mode & S_IXGRP) {
|
|
|
- ip->i_d.di_mode &= ~S_ISGID;
|
|
|
- }
|
|
|
- xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
|
|
|
- xfs_trans_set_sync(tp);
|
|
|
- error = xfs_trans_commit(tp, 0);
|
|
|
- xfs_iunlock(ip, XFS_ILOCK_EXCL);
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
/*
|
|
|
* Force a shutdown of the filesystem instantly while keeping
|
|
|
* the filesystem consistent. We don't do an unmount here; just shutdown
|