nfsd: Fix possible BUG_ON firing in set_change_info
commit74526c3deda36c784c87ba977550234a95ecbb05
authorNeil Brown <neilb@suse.de>
Thu, 2 Dec 2010 00:14:30 +0000 (2 11:14 +1100)
committerAK <andi@firstfloor.org>
Sun, 6 Feb 2011 19:03:26 +0000 (6 11:03 -0800)
treeef1b229ad63d4f7912a7b9c3e38ee61290d1d173
parentcdda0cb15d14a9c49c337e0bb9b69a392290016d
nfsd: Fix possible BUG_ON firing in set_change_info

commit c1ac3ffcd0bc7e9617f62be8c7043d53ab84deac upstream.

If vfs_getattr in fill_post_wcc returns an error, we don't
set fh_post_change.
For NFSv4, this can result in set_change_info triggering a BUG_ON.
i.e. fh_post_saved being zero isn't really a bug.

So:
 - instead of BUGging when fh_post_saved is zero, just clear ->atomic.
 - if vfs_getattr fails in fill_post_wcc, take a copy of i_ctime anyway.
   This will be used i seg_change_info, but not overly trusted.
 - While we are there, remove the pointless 'if' statements in set_change_info.
   There is no harm setting all the values.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
fs/nfsd/nfs3xdr.c
fs/nfsd/xdr4.h