From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zheng Liu Subject: Re: [PATCH] ext4: take i_mutex in ext4_symlink to eliminate a warning from ext4_truncate Date: Wed, 27 Mar 2013 22:02:50 +0800 Message-ID: <20130327140250.GA4316@gmail.com> References: <1364390347-4360-1-git-send-email-wenqing.lz@taobao.com> <20130327134110.GI5861@thunk.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-ext4@vger.kernel.org, Zheng Liu To: Theodore Ts'o Return-path: Received: from mail-pa0-f46.google.com ([209.85.220.46]:54970 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750811Ab3C0NrH (ORCPT ); Wed, 27 Mar 2013 09:47:07 -0400 Received: by mail-pa0-f46.google.com with SMTP id rl6so363384pac.5 for ; Wed, 27 Mar 2013 06:47:06 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20130327134110.GI5861@thunk.org> Sender: linux-ext4-owner@vger.kernel.org List-ID: On Wed, Mar 27, 2013 at 09:41:10AM -0400, Theodore Ts'o wrote: > On Wed, Mar 27, 2013 at 09:19:07PM +0800, Zheng Liu wrote: > > From: Zheng Liu > > > > After applied this commit (8e4061cb), we will get a warning from > > ext4_truncate when i_mutex isn't taken. Here the assumption is that > > i_mutex should be taken when we do a truncation. In ext4_symlink we > > could need to call ext4_truncate to trim some blocks beyond i_size, but > > the i_mutex isn't taken. > > Hmm, and this is why I added the warning. Even after looking your > patch, I'm having trouble finding the codepath that results in > ext4_truncate() getting called from __page_symlink(). Can you send > the stack trace from the WARN_ON, just so I can see what I missed? Here it is. kernel: ------------[ cut here ]------------ kernel: WARNING: at fs/ext4/inode.c:3803 ext4_truncate+0x36/0x2d7 [ext4]() kernel: Hardware name: OptiPlex 780 kernel: Modules linked in: ext4(O) jbd2 crc16 cpufreq_ondemand ipv6 dm_mirror dm_region_hash dm_log dm_mod parport_pc parport dcdbas acpi_cpufreq mperf serio_raw button pcspkr i2c_i801 sg ehci_pci ehci_hcd e1000e ptp pps_core ext3 jbd sd_mod ahci libahci libata scsi_mod uhci_hcd radeon ttm drm_kms_helper drm hwmon i2c_algo_bit i2 c_core [last unloaded: crc16] kernel: Pid: 4152, comm: fsstress Tainted: G W O 3.9.0-rc4+ #6 kernel: Call Trace: kernel: [] warn_slowpath_common+0x85/0x9f kernel: [] warn_slowpath_null+0x1a/0x1c kernel: [] ext4_truncate+0x36/0x2d7 [ext4] kernel: [] ext4_write_begin+0x35f/0x3b9 [ext4] kernel: [] pagecache_write_begin+0x1c/0x1e kernel: [] __page_symlink+0x6d/0x10f kernel: [] ? ext4_orphan_add+0x1ea/0x219 [ext4] kernel: [] ext4_symlink+0x1ca/0x33e [ext4] kernel: [] vfs_symlink+0x7c/0xd6 kernel: [] sys_symlinkat+0x68/0xb9 kernel: [] sys_symlink+0x16/0x18 kernel: [] system_call_fastpath+0x16/0x1b kernel: ---[ end trace 05d179cc296c4f3a ]--- Regards, - Zheng