2.4.36-stable kernel tree
Revision | 63789b37d0e2344ca4da9d1c7dc49bae7368c466 (tree) |
---|---|
Zeit | 2005-06-08 01:26:54 |
Autor | NeilBrown <neilb@cse....> |
Commiter | Marcelo Tosatti |
[PATCH] Claim i_alloc_sem while changing file size in nfsd
nfsd should hold i_alloc_sem while calling notify_change
with ATTR_SIZE set, just like do_truncate does.
From: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
### Diffstat output
diff ./fs/nfsd/vfs.c~current~ ./fs/nfsd/vfs.c
@@ -301,6 +301,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | ||
301 | 301 | iap->ia_valid |= ATTR_CTIME; |
302 | 302 | |
303 | 303 | if (iap->ia_valid & ATTR_SIZE) { |
304 | + down_write(&inode->i_alloc_sem); | |
304 | 305 | fh_lock(fhp); |
305 | 306 | size_change = 1; |
306 | 307 | } |
@@ -311,6 +312,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | ||
311 | 312 | } |
312 | 313 | if (size_change) { |
313 | 314 | fh_unlock(fhp); |
315 | + up_write(&inode->i_alloc_sem); | |
314 | 316 | put_write_access(inode); |
315 | 317 | } |
316 | 318 | if (!err) |