Re: [patch 3/6] fs: sync_sb_inodes fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 10 Dec 2008 08:27:07 +0100
Nick Piggin <npiggin@xxxxxxx> wrote:

> +	if (sync) {
> +		struct inode *inode, *old_inode = NULL;
> +
> +		/*
> +		 * Data integrity sync. Must wait for all pages under writeback,
> +		 * because there may have been pages dirtied before our sync
> +		 * call, but which had writeout started before we write it out.
> +		 * In which case, the inode may not be on the dirty list, but
> +		 * we still have to wait for that writeout.
> +		 */
> +		list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
> +			struct address_space *mapping;
> +
> +			if (inode->i_state & (I_FREEING|I_WILL_FREE))
> +				continue;
> +			mapping = inode->i_mapping;
> +			if (mapping->nrpages == 0)
> +				continue;
> +			__iget(inode);
> +			spin_unlock(&inode_lock);
> +			/*
> +			 * We hold a reference to 'inode' so it couldn't have
> +			 * been removed from s_inodes list while we dropped the
> +			 * inode_lock.  We cannot iput the inode now as we can
> +			 * be holding the last reference and we cannot iput it
> +			 * under inode_lock. So we keep the reference and iput
> +			 * it later.
> +			 */

hm, tricky.

Can umount run concurrently with this?  What will it say about the busy
inode?


> +			iput(old_inode);
> +			old_inode = inode;
> +
> +			filemap_fdatawait(mapping);
> +
> +			cond_resched();
> +
> +			spin_lock(&inode_lock);
> +		}
> +		spin_unlock(&inode_lock);
> +		iput(old_inode);
> +	} else
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux