diff options
author | Christoph Hellwig <hch@infradead.org> | 2010-02-03 14:43:31 -0500 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-02-12 14:43:57 -0500 |
commit | 87185517de81101da5afbc82cefdeed6eeaa38fb (patch) | |
tree | 29cb781d74d5e81d941e1a913222de90f6266477 /fs/xfs/linux-2.6 | |
parent | 5322892d867e186c6b4c5fff5c99ea4863696a60 (diff) |
xfs: only clear the suid bit once in xfs_write
file_remove_suid already calls into ->setattr to clear the suid and
sgid bits if needed, no need to start a second transaction to do it
ourselves.
Note that xfs_write_clear_setuid issues a sync transaction while the
path through ->setattr doesn't, but that is consistant with the
other filesystems.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_lrw.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c index c80fa00d2ad7..eac6f80d786d 100644 --- a/fs/xfs/linux-2.6/xfs_lrw.c +++ b/fs/xfs/linux-2.6/xfs_lrw.c | |||
@@ -630,18 +630,9 @@ start: | |||
630 | * by root. This keeps people from modifying setuid and | 630 | * by root. This keeps people from modifying setuid and |
631 | * setgid binaries. | 631 | * setgid binaries. |
632 | */ | 632 | */ |
633 | 633 | error = -file_remove_suid(file); | |
634 | if (((xip->i_d.di_mode & S_ISUID) || | 634 | if (unlikely(error)) |
635 | ((xip->i_d.di_mode & (S_ISGID | S_IXGRP)) == | 635 | goto out_unlock_internal; |
636 | (S_ISGID | S_IXGRP))) && | ||
637 | !capable(CAP_FSETID)) { | ||
638 | error = xfs_write_clear_setuid(xip); | ||
639 | if (likely(!error)) | ||
640 | error = -file_remove_suid(file); | ||
641 | if (unlikely(error)) { | ||
642 | goto out_unlock_internal; | ||
643 | } | ||
644 | } | ||
645 | 636 | ||
646 | /* We can write back this queue in page reclaim */ | 637 | /* We can write back this queue in page reclaim */ |
647 | current->backing_dev_info = mapping->backing_dev_info; | 638 | current->backing_dev_info = mapping->backing_dev_info; |