code: function maybeStale (originalEr, path, opts, hasStaleLock, cb) {
    fs.stat(path, function (statEr, st) {
      if (statEr) {
        if (statEr.code === 'ENOENT') {
          // expired already!
          opts.stale = false
          debug('lock stale enoent retry', path, opts)
          exports.lock(path, opts, cb)
          return
        }
        return cb(statEr)
      }
  
      var age = Date.now() - st[exports.filetime].getTime()
      if (age <= opts.stale) return notStale(originalEr, path, opts, cb)
  
      debug('lock stale', path, opts)
      if (hasStaleLock) {
        exports.unlock(path, function (er) {
          if (er) return cb(er)
          debug('lock stale retry', path, opts)
          fs.link(path + '.STALE', path, function (er) {
            fs.unlink(path + '.STALE', function () {
              // best effort.  if the unlink fails, oh well.
              cb(er)
            })
          })
        })
      } else {
        debug('acquire .STALE file lock', opts)
        exports.lock(path + '.STALE', opts, function (er) {
          if (er) return cb(er)
          maybeStale(originalEr, path, opts, true, cb)
        })
      }
    })
  }
docs: Staleness checking algorithm 1. acquire $lock, fail 2. stat $lock, find that it is stale 3. acquire $lock.STALE 4. stat $lock, assert that it is still stale 5. unlink $lock 6. link $lock.STALE $lock 7. unlink $lock.STALE On any failure, clean up whatever we've done, and raise the error.