- update to rpm-4.12.0
OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=338
This commit is contained in:
@@ -2,18 +2,18 @@ Suspend exclusive database lock when scriptlets get called, allowing
|
||||
read access in scriptlets. Only needed for DB_PRIVATE (aka global)
|
||||
locking.
|
||||
|
||||
--- ./lib/backend/db3.c.orig 2012-06-01 10:50:11.000000000 +0000
|
||||
+++ ./lib/backend/db3.c 2012-06-01 10:50:19.000000000 +0000
|
||||
@@ -628,3 +628,59 @@ int dbiOpen(rpmdb rdb, rpmDbiTagVal rpmt
|
||||
|
||||
--- ./lib/backend/db3.c.orig 2014-08-04 12:25:29.288759808 +0000
|
||||
+++ ./lib/backend/db3.c 2014-08-04 12:30:30.829430726 +0000
|
||||
@@ -625,6 +625,63 @@ static int dbiFlock(dbiIndex dbi, int mo
|
||||
return rc;
|
||||
}
|
||||
+
|
||||
|
||||
+int dbiSuspendDBLock(dbiIndex dbi, unsigned int flags)
|
||||
+{
|
||||
+ struct flock l;
|
||||
+ int rc = 0;
|
||||
+ int fdno = -1;
|
||||
+ DB * db = dbi->dbi_db;
|
||||
+
|
||||
+ if (!dbi->dbi_lockdbfd)
|
||||
+ return 0;
|
||||
@@ -21,7 +21,7 @@ locking.
|
||||
+ return 0;
|
||||
+ if (_lockdbfd == 0)
|
||||
+ return 0;
|
||||
+ if (!(dbi->dbi_db->fd(dbi->dbi_db, &fdno) == 0 && fdno >= 0))
|
||||
+ if (!(db->fd(db, &fdno) == 0 && fdno >= 0))
|
||||
+ return 1;
|
||||
+ memset(&l, 0, sizeof(l));
|
||||
+ l.l_whence = 0;
|
||||
@@ -40,6 +40,7 @@ locking.
|
||||
+ int rc = 0;
|
||||
+ int tries;
|
||||
+ int fdno = -1;
|
||||
+ DB * db = dbi->dbi_db;
|
||||
+
|
||||
+ if (!dbi->dbi_lockdbfd)
|
||||
+ return 0;
|
||||
@@ -47,7 +48,7 @@ locking.
|
||||
+ return 0;
|
||||
+ if (_lockdbfd == 0)
|
||||
+ return 0;
|
||||
+ if (!(dbi->dbi_db->fd(dbi->dbi_db, &fdno) == 0 && fdno >= 0))
|
||||
+ if (!(db->fd(db, &fdno) == 0 && fdno >= 0))
|
||||
+ return 1;
|
||||
+ for (tries = 0; tries < 2; tries++) {
|
||||
+ memset(&l, 0, sizeof(l));
|
||||
@@ -64,9 +65,12 @@ locking.
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
--- ./lib/backend/dbi.h.orig 2012-03-20 08:07:25.000000000 +0000
|
||||
+++ ./lib/backend/dbi.h 2012-06-01 10:53:43.000000000 +0000
|
||||
@@ -90,6 +90,24 @@ struct dbiIndex_s {
|
||||
int dbiOpen(rpmdb rdb, rpmDbiTagVal rpmtag, dbiIndex * dbip, int flags)
|
||||
{
|
||||
const char *dbhome = rpmdbHome(rdb);
|
||||
--- ./lib/backend/dbi.h.orig 2014-06-26 06:51:54.101820242 +0000
|
||||
+++ ./lib/backend/dbi.h 2014-08-04 12:25:29.288759808 +0000
|
||||
@@ -92,6 +92,24 @@ struct dbiIndex_s {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -91,39 +95,39 @@ locking.
|
||||
|
||||
RPM_GNUC_INTERNAL
|
||||
/* Globally enable/disable fsync in the backend */
|
||||
--- ./lib/psm.c.orig 2012-06-01 10:50:11.000000000 +0000
|
||||
+++ ./lib/psm.c 2012-06-01 10:51:34.000000000 +0000
|
||||
@@ -419,10 +419,12 @@ static rpmRC runScript(rpmpsm psm, ARGV_
|
||||
--- ./lib/psm.c.orig 2014-08-04 12:25:29.289759769 +0000
|
||||
+++ ./lib/psm.c 2014-08-04 12:27:04.230340235 +0000
|
||||
@@ -291,10 +291,12 @@ static rpmRC runScript(rpmts ts, rpmte t
|
||||
if (sfd == NULL)
|
||||
sfd = rpmtsScriptFd(psm->ts);
|
||||
sfd = rpmtsScriptFd(ts);
|
||||
|
||||
+ rpmtsSuspendResumeDBLock(psm->ts, 0);
|
||||
rpmswEnter(rpmtsOp(psm->ts, RPMTS_OP_SCRIPTLETS), 0);
|
||||
+ rpmtsSuspendResumeDBLock(ts, 0);
|
||||
rpmswEnter(rpmtsOp(ts, RPMTS_OP_SCRIPTLETS), 0);
|
||||
rc = rpmScriptRun(script, arg1, arg2, sfd,
|
||||
prefixes, warn_only, selinux);
|
||||
rpmswExit(rpmtsOp(psm->ts, RPMTS_OP_SCRIPTLETS), 0);
|
||||
+ rpmtsSuspendResumeDBLock(psm->ts, 1);
|
||||
prefixes, warn_only, rpmtsPlugins(ts));
|
||||
rpmswExit(rpmtsOp(ts, RPMTS_OP_SCRIPTLETS), 0);
|
||||
+ rpmtsSuspendResumeDBLock(ts, 1);
|
||||
|
||||
/* Map warn-only errors to "notfound" for script stop callback */
|
||||
stoprc = (rc != RPMRC_OK && warn_only) ? RPMRC_NOTFOUND : rc;
|
||||
--- ./lib/rpmdb.c.orig 2012-06-01 10:50:11.000000000 +0000
|
||||
+++ ./lib/rpmdb.c 2012-06-01 10:50:19.000000000 +0000
|
||||
@@ -769,6 +769,12 @@ int rpmdbSync(rpmdb db)
|
||||
return dbiForeach(db->_dbi, dbiSync, 0);
|
||||
--- ./lib/rpmdb.c.orig 2014-08-04 12:25:15.106821818 +0000
|
||||
+++ ./lib/rpmdb.c 2014-08-04 12:25:29.289759769 +0000
|
||||
@@ -475,6 +475,12 @@ exit:
|
||||
return rc;
|
||||
}
|
||||
|
||||
+int rpmdbSuspendResumeDBLock(rpmdb db, int mode)
|
||||
+{
|
||||
+ if (db == NULL) return 0;
|
||||
+ return dbiForeach(db->_dbi, mode ? dbiResumeDBLock : dbiSuspendDBLock, 0);
|
||||
+ return dbiForeach(db->db_indexes, db->db_ndbi, mode ? dbiResumeDBLock : dbiSuspendDBLock, 0);
|
||||
+}
|
||||
+
|
||||
static rpmdb newRpmdb(const char * root, const char * home,
|
||||
int mode, int perms, int flags)
|
||||
{
|
||||
--- ./lib/rpmts.c.orig 2012-03-20 08:07:25.000000000 +0000
|
||||
+++ ./lib/rpmts.c 2012-06-01 10:50:19.000000000 +0000
|
||||
@@ -95,6 +95,11 @@ int rpmtsOpenDB(rpmts ts, int dbmode)
|
||||
--- ./lib/rpmts.c.orig 2014-06-26 06:51:54.653818721 +0000
|
||||
+++ ./lib/rpmts.c 2014-08-04 12:25:29.289759769 +0000
|
||||
@@ -101,6 +101,11 @@ int rpmtsOpenDB(rpmts ts, int dbmode)
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -134,10 +138,10 @@ locking.
|
||||
+
|
||||
int rpmtsInitDB(rpmts ts, int dbmode)
|
||||
{
|
||||
rpmlock lock = rpmtsAcquireLock(ts);
|
||||
--- ./lib/rpmts.h.orig 2012-03-20 08:07:25.000000000 +0000
|
||||
+++ ./lib/rpmts.h 2012-06-01 10:50:19.000000000 +0000
|
||||
@@ -423,6 +423,8 @@ rpmdb rpmtsGetRdb(rpmts ts);
|
||||
rpmtxn txn = rpmtxnBegin(ts, RPMTXN_WRITE);
|
||||
--- ./lib/rpmts.h.orig 2014-06-26 06:51:54.655818716 +0000
|
||||
+++ ./lib/rpmts.h 2014-08-04 12:25:29.290759730 +0000
|
||||
@@ -441,6 +441,8 @@ rpmdb rpmtsGetRdb(rpmts ts);
|
||||
void * rpmtsNotify(rpmts ts, rpmte te,
|
||||
rpmCallbackType what, rpm_loff_t amount, rpm_loff_t total);
|
||||
|
||||
|
Reference in New Issue
Block a user