On Mon, Dec 01, 2014 at 09:52:18PM -0600, Boris Goldberg wrote: > Hello misc, > > I've reported a detailed bug two months ago. The short story - grace > period end time isn't being reset if the over_soft_quota stage is reached > by chown command. I've confirmed it on i386 5.0 through current (as of > month ago) and on amd64 5.4. > Developers seemed to don't have time for it, so I've asked our > consultant, Ed Bartosh <bart...@gmail.com> (not subscribed to the list), to > look into this. It seems like he has fixed it. Here is the patch for 5.4 > (tested on i386 only yet): >
Cool, but your mailer mangled the diff. Here it is for current. BTW, let's take this to tech@, that's a better place. So anybody replying, please rm misc@. -Otto Index: ufs_vnops.c =================================================================== RCS file: /cvs/src/sys/ufs/ufs/ufs_vnops.c,v retrieving revision 1.116 diff -u -p -r1.116 ufs_vnops.c --- ufs_vnops.c 3 Nov 2014 21:28:35 -0000 1.116 +++ ufs_vnops.c 2 Dec 2014 08:10:42 -0000 @@ -498,6 +498,7 @@ ufs_chown(struct vnode *vp, uid_t uid, g int error = 0; daddr_t change; enum ufs_quota_flags quota_flags = 0; + struct ucred *newcr; if (uid == (uid_t)VNOVAL) uid = DIP(ip, uid); @@ -534,16 +535,23 @@ ufs_chown(struct vnode *vp, uid_t uid, g if ((error = getinoquota(ip)) != 0) goto error; - if ((error = ufs_quota_alloc_blocks2(ip, change, cred, - quota_flags)) != 0) + newcr = crget(); + newcr->cr_uid = uid; + newcr->cr_gid = gid; + + if ((error = ufs_quota_alloc_blocks2(ip, change, newcr, + quota_flags)) != 0) { + crfree(newcr); goto error; + } - if ((error = ufs_quota_alloc_inode2(ip, cred , - quota_flags)) != 0) { - (void)ufs_quota_free_blocks2(ip, change, cred, - quota_flags); + if ((error = ufs_quota_alloc_inode2(ip, newcr, quota_flags)) != 0) { + (void)ufs_quota_free_blocks2(ip, change, newcr, quota_flags); + crfree(newcr); goto error; } + + crfree(newcr); if (getinoquota(ip)) panic("chown: lost quota");