Re: [PATCH] cifs: remove unnecessary copies of tcon->crfid.fid

From: Muhammad Usama Anjum
Date: Thu Apr 15 2021 - 10:55:27 EST


On Wed, 2021-04-14 at 14:00 +0200, Aurélien Aptel wrote:
> Muhammad Usama Anjum <musamaanjum@xxxxxxxxx> writes:
> > pfid is being set to tcon->crfid.fid and they are copied in each other
> > multiple times. Remove the memcopy between same pointers.
> >
> > Addresses-Coverity: ("Overlapped copy")
> > Fixes: 9e81e8ff74b9 ("cifs: return cached_fid from open_shroot")
> > Signed-off-by: Muhammad Usama Anjum <musamaanjum@xxxxxxxxx>
> > ---
> > I'm not sure why refcount was being incremented here. This file has been
> > evoloved so much. Any ideas?
>
> The fact that pfid is the same as the cache is very weird... Probably
> due to recent change.
>
> This function returns a cached dir entry for the root of the share which
> can be accessed/shared by multiple task.
>
Aurélien Aptel,

Thank you so much for awesome explanation. The whole function makes
sense now. We need to remove the memcpy calls only. We need to
increment the refcount (it was removed in this patch). I'll send a V2.

Regards,
Usama