Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7602042ybl; Thu, 16 Jan 2020 02:26:17 -0800 (PST) X-Google-Smtp-Source: APXvYqzM8KcLCmKJdhAysGJju7P3oW7m9tZveUxkECmVyVKYVrKXn2doAOszMJ7fOjy9HWmc9VEm X-Received: by 2002:a05:6830:1f19:: with SMTP id u25mr1453557otg.170.1579170377595; Thu, 16 Jan 2020 02:26:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579170377; cv=none; d=google.com; s=arc-20160816; b=D95iLro0OBoMuMbvUCU9xOJLrEyzZE29vvIo4uGPYeWT3Je36eSy7tU9l3nLYICR68 yg8JacMh6leLt0bTXsVhV5FhFfxniCZkG1pdLHvMGot0sBXsTPdcPhqLRE7sY6NYinVE fgpsrQGr1wqNwF90YRDNZ5u0xTSqMTbe0rPGvzfFvQl5zDQ5gXuu8mV58SYG4F13xxTE TGEbzJV6VQja5l27ysI8hDijDXRrGkGvVifN78Wff5VGiLUzew16tF1APyZy6003hdV8 5gSHCLLDucHmHwW4R/ky2o2aH1RfhALD7Rf4c2zkX44Psg55pDsTRROw1Rx/DaGRNYFR Ni9w== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=8YLvB3XoNFBQYdtBQKX47B+CGWk8SGLdVn5B91WfpIo=; b=WQXvSPDtR2LgCNL+jQO6++Ol/sUD+WJ7bgvE2Cs1mnV8UoLcsfagG+dbnr6re5WXhs G/6+dcHmwpNY2oESW/3sGWLcWzYegyP6mPZDgYn/QUauuQJ1ax4qNA+41JYgelg/hUd2 UwTa3RJyYJWVz65fwXZxthvBjAN4OYzwe5bejU3gbWAso5CS1Z8bRSv0rTMi03iPz+GS HiRozyfJnegimB5RrN/M7bkcXYHQE83n3cffKBKgPyPBmXU4nCyZQuTbIOQfrdmK/8Vb 30VeSdhCX580gxdrnJR8hsfg6oOIiFtWOwS8OW+OS8obyqTHo2jLPJFxbmXovsAxhLUv IJ9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jBhAcdhO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q26si10390505oij.38.2020.01.16.02.26.05; Thu, 16 Jan 2020 02:26:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jBhAcdhO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726151AbgAPKTx (ORCPT + 99 others); Thu, 16 Jan 2020 05:19:53 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:37678 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725800AbgAPKTx (ORCPT ); Thu, 16 Jan 2020 05:19:53 -0500 Received: by mail-wr1-f65.google.com with SMTP id w15so18567400wru.4; Thu, 16 Jan 2020 02:19:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=8YLvB3XoNFBQYdtBQKX47B+CGWk8SGLdVn5B91WfpIo=; b=jBhAcdhO41+t8pAlJ5bITHVITLqRCLcSpa4nKNE4I/MuP/cv2nVUtsYj5OSCCMXDil sbBooGPX8QKnJX04ji0TP1gpvEbbnNvPjS+/yn6JvZZqkWHr09wZAt8JB5wdA2Vd/b/N S+HIglPE37lwYJs8XR55sSZ9GPCu7zaoNbY1V6t38QPiS3kXzIDVWaDR1DQnuTMXU5Dj YJqPLcIno4bsLy6PlbyhnH9d0y4C3AUJXbjUi/CesBwvjO/m3yF9ahBXYxKB3H0m/sRO iGiZbFinx+1v6CWB7W+9fXP2UmRGgpVm3AdNFRE0Ozz/5QA8j7sbVEVsfp+ID6UsLODe FeFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=8YLvB3XoNFBQYdtBQKX47B+CGWk8SGLdVn5B91WfpIo=; b=LyA7+o37eVF5c5iwTi1v0FyOotwyNV6zEnRgSc2Mv1jTrPKVpHv2DeVsloSqsE2mbG a4EvLazSceF+DmefrXm7RNmMuPSgrAunRhjFzsKDfUE8VHuyr8z9UPfrKzl5/EEghmzU qkbVM2r0sqcZPckA52CP/Sds2u1HaxetVXwcu+b5jI2+vvQnDgaF2abwzqy/5LRJ8dl7 ejpUm1i8bT6D7AMemjE48Bl9YHy+rL+ngd+BuO5KnsWLSsMOaDksl5t4468Xo46kGP2R Qvb2e8Y5SFBNQW2jCZ6Sf3TnEy3XojkUhu2+sX3feLWmhOJbxpcK4A9I0xs4o2LXvxxo SGSA== X-Gm-Message-State: APjAAAXCX/LJiilNLsqyjQ3MdrkWwhjvG9WzOPhBmGTulAX3UHWIvVLQ GzU4r12hL4zSh4GnVSMhKC/t8gy/ X-Received: by 2002:a5d:4044:: with SMTP id w4mr2475282wrp.322.1579169990172; Thu, 16 Jan 2020 02:19:50 -0800 (PST) Received: from pali ([2a02:2b88:2:1::5cc6:2f]) by smtp.gmail.com with ESMTPSA id p7sm2260591wmp.31.2020.01.16.02.19.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2020 02:19:49 -0800 (PST) Date: Thu, 16 Jan 2020 11:19:47 +0100 From: Pali =?utf-8?B?Um9ow6Fy?= To: Arnd Bergmann Cc: Namjae Jeon , Namjae Jeon , "linux-kernel@vger.kernel.org" , Linux FS-devel Mailing List , gregkh , Valdis Kletnieks , Christoph Hellwig , sj1557.seo@samsung.com Subject: Re: [PATCH v10 09/14] exfat: add misc operations Message-ID: <20200116101947.4szdyfwpyasv5vpe@pali> References: <20200115082447.19520-1-namjae.jeon@samsung.com> <20200115082447.19520-10-namjae.jeon@samsung.com> <20200115133838.q33p5riihsinp6c4@pali> <20200115142428.ugsp3binf2vuiarq@pali> <20200115153943.qw35ya37ws6ftlnt@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 15 January 2020 16:52:12 Arnd Bergmann wrote: > On Wed, Jan 15, 2020 at 4:39 PM Pali Rohár wrote: > > On Wednesday 15 January 2020 16:03:12 Arnd Bergmann wrote: > > > The vdso and kernel/time/ code are for maintaining the timezone through > > > settimeofday()/gettimeofday(), and the drivers should probably all be changed > > > to use UTC. The file systems (affs, fat, hfs, hpfs and udf) do this for > > > compatibility with other operating systems that store the metadata in > > > localtime. > > > > Ok. But situation for exFAT is quite different. exFAT timestamp > > structure contains also timezone information. Other filesystems do not > > store timezone into their metadata (IIRC udf is exception and also > > stores timezone). So question is in which timezone we should store to > > exFAT timestamps. This is not for compatibility with legacy systems, but > > because of fact that filesystem supports feature which is not common for > > other filesystems. > > > > Also, to make it more complicated exFAT supports storing timestamps also > > in "unspecified" (local user) timezone, which matches other linux > > filesystems. > > > > So for storing timestamp we have options: > > > > * Store them without timezone > > * Store them in sys_tz timezone > > * Store them in timezone specified in mount option > > * Store them in UTC timezone > > > > And when reading timestamp from exFAT we need to handle both: > > > > * Timestamps without timezone > > * Timestamps with timezone > > Right. > > > So what is the best way to handle timezone/timestamps? > > > > For me it looks sane: > > > > When storing use: mount option timezone. When not available then use > > sys_tz. And when sys_tz is not set (it is possible?), do not specify > > timezone at all. Maybe there should be a mount option which says that > > timestamps on exfat are stored without timezone. > > I would argue we should always store files in UTC, which seems to be > the most consistent with other file systems, and can be understood > by any other implementation that understands the timezone information > on disk or that expects UTC. exFAT timezone information needs to be understand by any exFAT implementation. I looked into exFAT specification and it has following information how implementation should choose timezone: https://docs.microsoft.com/en-us/windows/win32/fileio/exfat-specification#74101-offsetfromutc-field However, implementations should only record the value 00h for this field when: 1. Local date and time are actually the same as UTC, in which case the value of the OffsetValid field shall be 1 2. Local date and time are not known, in which case the value of the OffsetValid field shall be 1 and implementations shall consider UTC to be local date and time 3. UTC is not known, in which case the value of the OffsetValid field shall be 0 I'm not sure if storing time always in UTC is fine with specification. Mount option which specify timezone can solve this problem, but only in case when it is specified. > > When reading timestamp with timezone: Convert timestamp to timezone > > specified in mount option (or fallback to sys_tz or fallback to UTC). > > Here I would just convert to UTC, which is what we store in the > in-memory struct inode anyway. Ok. If inode timestamp is always in UTC, we should do same thing also for exFAT. > > And when reading timestamp without timezone: Pass it as is without > > conversion, ignoring all timezone mount options and sys_tz. > > > > Arnd, what do you think about it? > > The last case (reading timestamp without timezone) is the only > one that I think we have to decide on: when reading an inode from > disk into memory, we have to convert it into UTC in some form. > > This is what I think the timezone mount option should be used > for: if we don't know what the timezone was for the on-disk > timestamp, use the one provided by the user. I agree, this make sense. > However, if none > was specified, it should be either sys_tz or UTC (i.e. no > conversion). I would prefer the use of UTC here given the > problems with sys_tz, but sys_tz would be more consistent > with how fs/fat works. Hm... both UTC and sys_tz have positives and negatives. And I'm not sure which option is better. Do we know how Tuxera or Paragon solved this dilema in their exFAT implementations? IIRC Paragon already sent their implementation to LKML. -- Pali Rohár pali.rohar@gmail.com