]> granicus.if.org Git - apache/commitdiff
Revert removal of the key_type byte in the lock key. There is no need to break
authorStefan Fritsch <sf@apache.org>
Tue, 10 Nov 2009 16:32:57 +0000 (16:32 +0000)
committerStefan Fritsch <sf@apache.org>
Tue, 10 Nov 2009 16:32:57 +0000 (16:32 +0000)
the format on systems without inodes.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@834533 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/dav/fs/lock.c

diff --git a/CHANGES b/CHANGES
index f38e9cae2fcd08442fbc6077676564561450a213..f9825dbf6fa09b33f12320b84f5d9c8d0a92854c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -30,8 +30,9 @@ Changes with Apache 2.3.3
      old file if the transfer aborted. PR 39815. [Paul Querna, Stefan Fritsch]
 
   *) mod_dav_fs: Remove inode keyed locking as this conflicts with atomically
-     creating files. This is a format cange of the DavLockDB. The old
-     DavLockDB must be deleted on upgrade. [Stefan Fritsch]
+     creating files. On systems with inode numbers, this is a format cange of
+     the DavLockDB. The old DavLockDB must be deleted on upgrade.
+     [Stefan Fritsch]
 
   *) mod_log_config: Make ${cookie}C correctly match whole cookie names
      instead of substrings. PR 28037. [Dan Franklin <dan dan-franklin.com>,
index 97aa7eab45f67495603d81e29a72af9fe9132cb7..41dc5ed9e6c2f3a740611caaed7814efcded801e 100644 (file)
@@ -48,7 +48,8 @@
 **
 ** KEY
 **
-** The database is keyed by the full path.
+** The database is keyed by a key_type unsigned char (DAV_TYPE_FNAME)
+** followed by the full path. The key_type DAV_TYPE_INODE is not used anymore.
 **
 ** VALUE
 **
 #define DAV_LOCK_DIRECT         1
 #define DAV_LOCK_INDIRECT       2
 
+/*
+ * not used anymore
+ * #define DAV_TYPE_INODE          10
+ */
+#define DAV_TYPE_FNAME          11
+
 
 /* ack. forward declare. */
 static dav_error * dav_fs_remove_locknull_member(apr_pool_t *p,
@@ -379,8 +386,11 @@ static apr_datum_t dav_fs_build_key(apr_pool_t *p,
     /* ### does this allocation have a proper lifetime? need to check */
     /* ### can we use a buffer for this? */
 
-    key.dsize = strlen(pathname) + 1;
-    key.dptr = apr_pstrmemdup(p, pathname, key.dsize - 1);
+    /* size is TYPE + pathname + null */
+    key.dsize = strlen(pathname) + 2;
+    key.dptr = apr_palloc(p, key.dsize);
+    *key.dptr = DAV_TYPE_FNAME;
+    memcpy(key.dptr + 1, pathname, key.dsize - 1);
     if (key.dptr[key.dsize - 2] == '/')
         key.dptr[--key.dsize - 1] = '\0';
     return key;
@@ -579,14 +589,15 @@ static dav_error * dav_fs_load_lock_record(dav_lockdb *lockdb, apr_datum_t key,
                 need_save = DAV_TRUE;
 
                 /* Remove timed-out locknull fm .locknull list */
-                {
+                if (*key.dptr == DAV_TYPE_FNAME) {
+                    const char *fname = key.dptr + 1;
                     apr_finfo_t finfo;
                     apr_status_t rv;
 
                     /* if we don't see the file, then it's a locknull */
-                    rv = apr_stat(&finfo, key.dptr, APR_FINFO_MIN | APR_FINFO_LINK, p);
+                    rv = apr_stat(&finfo, fname, APR_FINFO_MIN | APR_FINFO_LINK, p);
                     if (rv != APR_SUCCESS && rv != APR_INCOMPLETE) {
-                        if ((err = dav_fs_remove_locknull_member(p, key.dptr, &buf)) != NULL) {
+                        if ((err = dav_fs_remove_locknull_member(p, fname, &buf)) != NULL) {
                             /* ### push a higher-level description? */
                             return err;
                         }