From: Jaegeuk Kim Subject: Re: [PATCH] f2fs: fix up f2fs_get_parent issue to retrieve correct parent inode number Date: Thu, 13 Dec 2012 09:14:11 +0900 Message-ID: <1355357651.24219.21.camel@kjgkr> References: <1355323077-5803-1-git-send-email-linkinjeon@gmail.com> Reply-To: jaegeuk.kim@samsung.com Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-qq+sRZ+NBtG2FoiDp4YH" Cc: Leon Romanovsky , Fubo Chen , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Namjae Jeon , Amit Sahrawat To: Namjae Jeon Return-path: In-reply-to: Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org --=-qq+sRZ+NBtG2FoiDp4YH Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 2012-12-13 (=EB=AA=A9), 07:44 +0900, Namjae Jeon: > 2012/12/13, Leon Romanovsky : > > On Wed, Dec 12, 2012 at 8:50 AM, Fubo Chen wrote: > >> On Wed, Dec 12, 2012 at 5:12 PM, Leon Romanovsky wrote: > >>> On Wed, Dec 12, 2012 at 7:05 AM, Fubo Chen wrot= e: > >>>> > >>>> On Wed, Dec 12, 2012 at 3:37 PM, Namjae Jeon > >>>> wrote: > >>>> > + /* dot and dotdot dentries should have zero-value hash cod= e > >>>> > */ > >>>> > + if (!memcmp(name, ".", 1) || !memcmp(name, "..", 2)) > >>>> > + return 0; > >>>> > >>>> That looks suspicious. If memcmp(name, "..", 2) =3D=3D 0 then always > >>>> memcmp(name, ".", 1) =3D=3D 0. Why two tests ? > >>> > >>> It is not the case vice versa, so you still need to do two checks. > >>> You need to distinguish dot(.), dotdot(..) and something with dot at > >>> the beginning (for example - .o) > >> > >> Thanks for replying. I understand that the intention is what you > >> explained. But to me the code says something else: "if the first byte > >> of name is a dot, return 0". Did I see that correctly ? > > Excellent catch, I agree with you It will also return 0 for every file > > which starts from the dot. > > The right solution must take name length into account. > Hi. > Agree. I will change it on v2 patch. > Thanks for review. Nice catch! I made a mistake initially before. Sorry Namjae. Thanks to all of you. --=20 Jaegeuk Kim Samsung --=-qq+sRZ+NBtG2FoiDp4YH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJQyR3TAAoJEEAUqH6CSFDShKoP/jXHVtLGK7IyJpSWGcZFOQEw JpC8ARex2fQEq61YHvhlfULeLO2e7ihzuavVUW/JkG8jIjU88mEtshUeAh9zKk8m HIvOcMwgVgpVHCSnfifmZ5M8e4Gd73RkFP2TQXaWulBFv0LOaR/kBl55a0d2vP/I 1F/CnqC0BtCS1gEJ6RcQe9OexmUbvIhn3pU76bq/1x9m+mJsm3/sOReg1qVs0J3X Mcaf9dOtunXQFU7umJ4l6bTEmDkIOW08aKvNaPiz8SFFZnYWcQHt3iFKyM/ArGlp PI+Z5x6zlpMLOKF5Qs63BwsjXc01AyAZo6bjL4SmMKizBiOf+K/a0KfEVPYUXVkQ Lzyd94JD2HxVHqibcY8F0loGInUHqyT+3EWHQ2QNcB8phPEre76AOXbsw8CANFsQ RTFGD7oYJjhTSPOnQ73Gmzt0FFNZffojvYlY4UEKOqYGHcqkVK7sK8FpK7TOfH37 otPlgX+6FQLG1HYktenjD0XYdPCd8rtdfk2nV09mBtBOBgOBxpS3ulDyTKjljlTu LUUiTRthg3xcmzzejvS2OiHfTnCI1ZKP+s+7Uh1etMuuPHur4/qwF6Q6gSFQZ43n XkWOrfWBx+WY1SKi04lwoYCl4jwjSaeDMuIjaHZLayEvMSGYCeWjuWUBR+bwRS1Y Gy2RmlmSQ7QUh1VtSaVv =fb03 -----END PGP SIGNATURE----- --=-qq+sRZ+NBtG2FoiDp4YH--