[OpenAFS-devel] possible bug in afs_vnop_flock.c:GetFlockCount

Nathan Neulinger nneul@umr.edu
01 Mar 2003 11:34:20 -0600


This routine contacts the server to see if the file is locked anywhere.

In it's code, it has the following snippets:

	temp = areq->flags & O_NONBLOCK;
	areq->flags |= O_NONBLOCK;

	........
	
	if ( temp )
		areq->flags &= ~O_NONBLOCK;



Sure looks to me like that is intended to temporarily set O_NONBLOCK,
and restore the previous state of that flag bit when done without
touching any other flags in areq which may or may not have changed.

Shouldn't the last piece be:
	
	if ( !temp )
		areq->flags &= ~O_NONBLOCK;

i.e. clear flag if it wasn't previously set?

Current logic seems to only clear the flag if it was previously set.

I don't know if this would really have any impact, but if that behavior
is intended, should probably be commented as such.

-- Nathan

------------------------------------------------------------
Nathan Neulinger                       EMail:  nneul@umr.edu
University of Missouri - Rolla         Phone: (573) 341-4841
Computing Services                       Fax: (573) 341-4216