• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: my filesystem vs Finder. "error -50" what does it mean?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: my filesystem vs Finder. "error -50" what does it mean?


  • Subject: Re: my filesystem vs Finder. "error -50" what does it mean?
  • From: Anatol Pomozov <email@hidden>
  • Date: Fri, 27 Apr 2012 11:15:53 -0700

Hi

On Mon, Apr 16, 2012 at 2:29 PM, Jim Luther <email@hidden> wrote:
On Apr 16, 2012, at 2:06 PM, Anatol Pomozov <email@hidden> wrote:

> Hi,
>
> I am working on my filesystem (fuse4x - fuse implementation for macosx). And sometimes I have bugs in it that lead to Finder errors.

The Finder is an application and it is just reporting an error condition -- it may or may not be generating the -50 error.

> For example Finder popups with "error -50" and I suspect that it is related to setattr() function, probably size of the written file. Finder does not like something that my filesystem does.

-50 is defined as paramErr in MacErrors.h. It is kind of a "catch all" error code that is returned when either (1) a bad argument is passed to an API or (2) an unexpected result comes back from a POSIX/BSD request and it cannot be translated to something better.

> And I want to know what *exactly* Finder does not like.

It's not that easy (unless your working on the Finder team).

fs_usage(1) might be useful for getting you close to the problem -- it will let you see the file system requests made by the Finder process.

> Is there any table that explains all the "error -N" popup errors? Is this part of Finder open so I can read it?

<CarbonCore/MacErrors.h> has most of them. Apple stopped putting new error codes there some time ago and so newer error codes are spread throughout various headers where they are defined by the part of the OS that uses them.

Thanks for the information and for the useful tools (I found fs_usage quite interesting).

After a few days of reading logs, git bisecting my project and changing bits of sources I finally was able to 'fix' the issue. Saying that I still think that "error -NN" messages from Finder are extremely unhelpful, there are should be other ways to get more detailed description of the problem.

Anyway, the issue appeared in my fuse4x filesystem when I set VFS_TBLTHREADSAFE. After that I start seeing the issue I described in the original message. VFS_TBLTHREADSAFE effectively removes per vnode lock so VNOP operations might happens simultaneously.

It seems that after Finder copies a file it calls VNOP_GETATTR and checks the size vnop attribute. If this size does not match original size - Finder/Carbon fails with -50 error.

So why error happens with VFS_TBLTHREADSAFE flag but does not happen without it? It looks like if VFS_TBLTHREADSAFE is not set then VNOP_WRITE plus subsequent VNOP_STRATEGY executed as atomic operation, such as

VNOP_WRITE
VNOP_STRATEGY
VNOP_STRATEGY
..
VNOP_GETATTR   --- from Finder



It worth mention VNOP_STRATEGY does the actual data write to fuse filesystem. When VNOP_STRATEGY happens only then fuse filesystem is notified about the file change.



With VFS_TBLTHREADSAFE following sequence happens


VNOP_WRITE
VNOP_GETATTR   <-- return old file size
VNOP_STRATEGY
VNOP_STRATEGY

It looks like write returns to Finder but data is not written to fuse filesystem yet, data buffered in the kernel buffer cache. Then Finder checks the output file size and receives the old size - error! I was able to 'fix' the issue by caching the new file size and return in VNOP_GETATTR.

This actually weird as my filesystem is marked as 'synchronous' so I expect that write syscall returned only when all buffers are flushed to filesystem (by VNOP_STRATEGY). Note for myself: I need to dig into write+strategy sources to understand their relationship better.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: my filesystem vs Finder. "error -50" what does it mean?
      • From: Mark Day <email@hidden>
References: 
 >my filesystem vs Finder. "error -50" what does it mean? (From: Anatol Pomozov <email@hidden>)
 >Re: my filesystem vs Finder. "error -50" what does it mean? (From: Jim Luther <email@hidden>)

  • Prev by Date: Re: Is there any way to setup a non-HFS volume sharing with AFP?
  • Next by Date: Re: my filesystem vs Finder. "error -50" what does it mean?
  • Previous by thread: Filesystem debugging - was: my filesystem vs Finder. "error -50" what does it mean?
  • Next by thread: Re: my filesystem vs Finder. "error -50" what does it mean?
  • Index(es):
    • Date
    • Thread