Re: [PATCH 2/2] close_lock_file(): new function in the lockfile API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 16 Jan 2008, Junio C Hamano wrote:

Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> writes:

On Wed, 16 Jan 2008, Junio C Hamano wrote:
+
+void close_lock_file(struct lock_file *lk)
+{
+	close(lk->fd);
+	lk->fd = -1;
+}

Since one of the main purposes of closing would be the error testing of
writes that haven't made it out yet on filesystems like NFS that do
open-close cache serialization, I'd suggest doing this as

	int close_lock_file(struct lock_file *lk)
	{
		int fd = lk->fd;
		lk->df = -1;
		return close(fd);
	}

to give the return code.

Yup!  You are as always right.

My patch does this, though I understand it may take some time to review.

I left the lk->fd unmodified when close() failed in case the caller
would like to include it in an error message.

-brandon

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux