Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6785185ybl; Mon, 23 Dec 2019 11:53:54 -0800 (PST) X-Google-Smtp-Source: APXvYqwGnnVixuS7PJMup+xr8BPhQLvTOJVhmLRU3UO2dKfcGsVcTTfvOwvNYs8e2EAoo/SA5sfn X-Received: by 2002:a9d:7f12:: with SMTP id j18mr35737623otq.17.1577130834350; Mon, 23 Dec 2019 11:53:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577130834; cv=none; d=google.com; s=arc-20160816; b=IE+LSciduLCMganwn/Ag+0dixMHCzFKUjlyEPQq1wusqAuH98ScXGo8VaUF9r06Ecc T1VvI2QD+ug/0+3C/LvnOAoDQBhdFj/2XNG3U5rknPfZSfgLQNqKA3hN/ZSF5u/5DLAC jSZag0qpOsSfpuuaNcjK7nS3bp7jZTfKnW/mCDHfAmFtWEUd14Kwqw77jE/57fgbdUQ1 GEwYcGY1snpW3FaEOuLsdOAgSeEG0Oj/jA1m+eXgamrxeqd3OetbxuBe2HQJQZjfSGYI lKcMcQlKZj/hIU0QNUo+x5cJTQ3Y+k1Ms3lQ5Cdc7yTD03bWqA5d2xfs84iAF6qDTABp h4uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=M8bsqXnADijuPdeKx2/Kd8dsV00qYSVARPWo4T2UjEU=; b=mMMuVt5LiFycAvKDb0d+B9Nei4QyfErPA7SdsOw+ubdCiTqcFmtRnQzm56S27FvW12 TpodAAQqSTwzLlWxGYRKmbspMVnrTCXP2sw7nKGeAULc4lPIKc8RNq3XezzVRAodMedj hyCv8WFbjQOzbJh7/A5B3XZBQ2ZdjvO9aXXP37+XaQQfx6G+F9pYjxoPJkFfIb7wNged zU5OtqqEeKSiwfL7tPeCh2cu4ZuB7sLenBk/v3JExFMTwvJginv/hKHtiybABVw74lOu Tm/i0VfAnneRpWalnT1NbpbRt/eeBY0PblviaMQjrulJ/pmCkQ3/DAybQcOUinO7yejN wrOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k7si8754553otb.90.2019.12.23.11.53.29; Mon, 23 Dec 2019 11:53:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726829AbfLWTx2 (ORCPT + 99 others); Mon, 23 Dec 2019 14:53:28 -0500 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:59299 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726766AbfLWTx2 (ORCPT ); Mon, 23 Dec 2019 14:53:28 -0500 Received: from callcc.thunk.org (guestnat-104-133-0-111.corp.google.com [104.133.0.111] (may be forged)) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id xBNJr19e001916 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Dec 2019 14:53:02 -0500 Received: by callcc.thunk.org (Postfix, from userid 15806) id 1C82A420822; Mon, 23 Dec 2019 14:53:01 -0500 (EST) Date: Mon, 23 Dec 2019 14:53:01 -0500 From: "Theodore Y. Ts'o" To: Andrea Vai Cc: Ming Lei , "Schmid, Carsten" , Finn Thain , Damien Le Moal , Alan Stern , Jens Axboe , Johannes Thumshirn , USB list , SCSI development list , Himanshu Madhani , Hannes Reinecke , Omar Sandoval , "Martin K. Petersen" , Greg KH , Hans Holmberg , Kernel development list , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: AW: Slow I/O on USB media after commit f664a3cc17b7d0a2bc3b3ab96181e1029b0ec0e6 Message-ID: <20191223195301.GC3282@mit.edu> References: <20191211160745.GA129186@mit.edu> <20191211213316.GA14983@ming.t460p> <20191218094830.GB30602@ming.t460p> <20191223130828.GA25948@ming.t460p> <20191223162619.GA3282@mit.edu> <4c85fd3f2ec58694cc1ff7ab5c88d6e11ab6efec.camel@unipv.it> <20191223172257.GB3282@mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon, Dec 23, 2019 at 07:45:57PM +0100, Andrea Vai wrote: > basically, it's: > > mount UUID=$uuid /mnt/pendrive > SECONDS=0 > cp $testfile /mnt/pendrive > umount /mnt/pendrive > tempo=$SECONDS > > and it copies one file only. Anyway, you can find the whole script > attached. OK, so whether we are doing the writeback at the end of cp, or when you do the umount, it's probably not going to make any difference. We can get rid of the stack trace in question by changing the script to be basically: mount UUID=$uuid /mnt/pendrive SECONDS=0 rm -f /mnt/pendrive/$testfile cp $testfile /mnt/pendrive umount /mnt/pendrive tempo=$SECONDS I predict if you do that, you'll see that all of the time is spent in the umount, when we are trying to write back the file. I really don't think then this is a file system problem at all. It's just that USB I/O is slow, for whatever reason. We'll see a stack trace in the writeback code waiting for the I/O to be completed, but that doesn't mean that the root cause is in the writeback code or in the file system which is triggering the writeback. I suspect the next step is use a blktrace, to see what kind of I/O is being sent to the USB drive, and how long it takes for the I/O to complete. You might also try to capture the output of "iostat -x 1" while the script is running, and see what the difference might be between a kernel version that has the problem and one that doesn't, and see if that gives us a clue. > > And then send me > btw, please tell me if "me" means only you or I cc: all the > recipients, as usual Well, I don't think we know what the root cause is. Ming is focusing on that stack trace, but I think it's a red herring..... And if it's not a file system problem, then other people will be best suited to debug the issue. - Ted