707 ((xip->i_d.di_mode & (S_ISGID | S_IXGRP)) ==
708 (S_ISGID | S_IXGRP))) &&
709 !capable(CAP_FSETID)) {
710 error = xfs_write_clear_setuid(xip);
711 if (likely(!error))
712 error = -file_remove_suid(file);
713 if (unlikely(error)) {
714 goto out_unlock_internal;
715 }
716 }
717
718retry:
719
720 current->backing_dev_info = mapping->backing_dev_info;
721
722 if ((ioflags & IO_ISDIRECT)) {
723 if (mapping->nrpages) {
724 WARN_ON(need_i_mutex == 0);
725 xfs_inval_cached_trace(xip, pos, -1,
726 (pos & PAGE_CACHE_MASK), -1);
727 error = xfs_flushinval_pages(xip,
728 (pos & PAGE_CACHE_MASK),
729 -1, FI_REMAPF_LOCKED);
730 if (error)
731 goto out_unlock_internal;
732 }
733
734 if (need_i_mutex) {
735
736 xfs_ilock_demote(xip, XFS_IOLOCK_EXCL);
737 mutex_unlock(&inode->i_mutex);
738
739 iolock = XFS_IOLOCK_SHARED;
740 need_i_mutex = 0;
741 }
742
743 xfs_rw_enter_trace(XFS_DIOWR_ENTER, xip, (void *)iovp, segs,
744 *offset, ioflags);
745 ret = generic_file_direct_write(iocb, iovp,
746 &segs, pos, offset, count, ocount);
747