[OpenAFS] Re: openafs does not put a [correct] value in fsinfo.f_type?

Adam Megacz megacz@cs.berkeley.edu
Mon, 25 Dec 2006 20:46:52 -0800


Jeffrey Altman <jaltman@secure-endpoints.com> writes:
> I don't know how the Linux kernel is determining that it should activate
> this functionality.

OpenAFS asks it to -- afs_linux_lock() calls posix_lock_file() in osi_vnodeops.c.

...
    AFS_GLOCK();
    code = afs_lockctl(vcp, &flock, cmd, credp);
    AFS_GUNLOCK();

#ifdef AFS_LINUX24_ENV
    if (code == 0 && (cmd == F_SETLK || cmd == F_SETLKW)) {
#ifdef AFS_LINUX26_ENV
       struct file_lock flp2;
       flp2 = *flp;
       flp2.fl_flags &=~ FL_SLEEP;
       code = posix_lock_file(fp, &flp2);
#else
       code = posix_lock_file(fp, flp, 0);
#endif 
       osi_Assert(code != -EAGAIN); /* there should be no conflicts */
       if (code) {
           struct AFS_FLOCK flock2;
           flock2 = flock;
           flock2.l_type = F_UNLCK;
           AFS_GLOCK();
           afs_lockctl(vcp, &flock2, F_SETLK, credp);
           AFS_GUNLOCK();
       }
    }
#endif
...

  - a

-- 
PGP/GPG: 5C9F F366 C9CF 2145 E770  B1B8 EFB1 462D A146 C380