From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suresh Jayaraman Subject: Re: [PATCH] CIFS: Fix mkdir/rmdir bug for the non-POSIX case Date: Mon, 13 Feb 2012 12:56:40 +0530 Message-ID: <4F38BB30.9030107@suse.com> References: <1328810892-21925-1-git-send-email-piastry@etersoft.ru> <20120210132216.03badf59@tlielax.poochiereds.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Pavel Shilovsky , linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Jeff Layton Return-path: In-Reply-To: <20120210132216.03badf59-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org> Sender: linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: On 02/10/2012 11:52 PM, Jeff Layton wrote: > On Thu, 9 Feb 2012 21:08:12 +0300 > Pavel Shilovsky wrote: > >> Currently we do inc_nlink/drop_nlink for a parent directory for every >> mkdir and rmdir calls. That's wrong when POSIX extensions are disabled >> because in this case a server doesn't do the same things and returns >> the old value on the next QueryInfo request. As the result, we update >> our value with the server one and then decrement it on every rmdir >> call - go to negative nlink values. >> >> Fix this by doing inc_nlink/drop_nlink for parent directory in mkdir >> and rmdir in POSIX case only. Also add cERROR when nlink value <= 2 >> and we still try to decrement it (possible broken servers). >> > > Rather than doing that, I think it would be better not to do the > inc/dec_nlink in either case and instead to set cifsi->time on the > parent to 0 for both cases. > > That should force it to have the directory attributes refetched at the > next opportunity. Since we're not doing that now, we're likely missing > out on stuff like directory mtime changes as well. > Hmm.. don't we have to do both? Keep the nlink value sane and force refetching attrs. Wondering if we don't update nlink what will happen in cases (a) when mkdir/rmdir is run in a tight loop (b) when a dir is moved from one to another within the cifs mount Thanks Suresh